PHP func_get_args function

The func_get_args function returns, as an array, the arguments that have been passed to the function containing the call. This allows you to simplify the previous code to use a foreach loop:

$arglist = func_get_args();
foreach ($arglist as $arg) {
  // process $arg
}

Like the other argument processing functions, it will generate a warning when not called from inside a function.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.