Should empty function arguments be set to NULL or FALSE?
As example follows:
function test1($a = FALSE, $b = FALSE)
{
if ($b)
{
// ... (some awesome code here)
}
//.. (more awesome code)
}
test1(0);
OR
function test2($a = NULL, $b = NULL)
{
if ($b !== NULL)
{
// ... (some awesome code here)
}
//.. (more awesome code)
}
test2(0);
Note; Also something to consider - while using $a === NULL. One could also use '!empty()' depending if the below code requires empty values or not.
Which is a better design and why?