PHP functions can be defined to accept optional parameters. I think you can also call functions that don't expect any arguments with a dozen if you like. If you call [man]func_num_args[/man] from within a function, it returns a number telling you how many parameters were supplied when the function was called. What's so confusing about that?
<?php
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs\n";
}
foo(1, 2, 3);
?>
[man]func_get_args[/man] gets the parameters themselves.