How to define a function with any number of arguments?



How to define a function with any number of arguments?..

Answer / Jyoti Yadav

In PHP, you can create a function that accepts any number of arguments using the func_num_args() and func_get_arg() functions. For example: function variableFunction() { for ($i = 0; $i < func_num_args(); $i++) { $arg[$i] = func_get_arg($i); } // do something with $arg array }

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Explain which cryptographic extension provide generation and verification of digital signatures?

1 Answers  


Is gender a dependent variable?

1 Answers  


When to use inquire vs enquire?

1 Answers  


Do you know what does $globals means?

1 Answers  


Write a hello world program using variable?

1 Answers  


Which will start a session?

1 Answers  


What is serialization / object serialization ?

2 Answers  


Write syntax to open a file in php?

1 Answers  


What are the uses of implode() function?

1 Answers  


How session works (internal processing of session) ?

3 Answers   ASD Lab, IPSR Solutions,


how to track user logged out or not? when a user is idle?

1 Answers  


Is server side a session?

1 Answers  


Categories