Which of the following PHP functions accepts any number of parameters?
func_get_args()
Correct:
func_get_args()
Explanation:func_get_args() returns an array of arguments provided. One can use func_get_args() inside the function to parse any number of passed parameters. Here is an example:
function foo()
{
$args = func_get_args();
foreach ($args as $k => $v)
{
echo "arg".($k+1).": $v\n";
}
}
foo();
/* will print nothing */
foo("Hello");
/* will print Hello */
foo("Hello","World","Bye");
/* will print Hello World Bye */