PHP func_num_args function

The func_num_args function returns the number of arguments that were passed to a function and must be called from within that function. For example:

function variable_argument_function () {
  $num_args = func_num_args();
  echo ("I was passed $num_args arguments.");
}
variable_argument_function ("w3m", 1, 2,2);

The output from this code snippet will be:

I was passed 4 arguments.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.