Voting

: min(one, two)?
(Example: nine)

The Note You're Voting On

art at geigel dot com
2 years ago
The size of the array resulting from func_get_args(), for instance using count(), does not take into account parameters that have been assigned default values in the function definition.

Example:

function foo($bar=true) {
echo count(func_get_args());
}

foo();
// echoes 0

foo("bar");
// echoes 1

A useful condition to test for when a function needs to return default behavior (whatever that might be) when no value is present and the value of $bar could be true, false, null, etc.

<< Back to user notes page

To Top