I just spent 10 minutes looking for a bug, when I found out I was passing something to a method as second parameter while it doesn’t take more than 1 parameter. I had to pass it through some other way.
That’s when my question arose: why doesn’t PHP throw an error when you pass a non-available parameter?
Am I missing something – other than my own func_get_args answer?
function test($a)
{
}
test('a', 'b'); // no error, but no 2nd parameter in test().
The only answer I can personally think of:
func_get_args enables you to dynamically fetch parameters from function calls, making any number of parameters valid.