Using the parameter list func_get_args ()

PHP func_get_args() docs:

Now this function can be used in parameter lists.

Can someone explain what this means and how to apply it?

+4
source share
1 answer

Prior to 5.3, this was impossible to do:

 function foo($a,$b) { var_dump(func_get_args()); } 

To get the arguments of the function (i.e. for debugging purposes), you had to assign the return value of func_get_args variable before the actual value:

 function foo($a,$b) { $args = func_get_args(); var_dump($args); } 

Using the immediate return value of func_get_args (without a temporary variable) is possible with PHP 5.3.

+4
source

All Articles