The switch won't work properly with a function call, unless that function call is non-parametrized (and then will not relate directly to the switched value). For that you need to continue using an if/else handle so that you can give it the variable (this is honestly pointless):
PHP Code:
switch ($a)
{
case is_numeric($a):
print '$a is numeric';
break;
}
While it will work, its easier to just write
if (is_numeric($a)).
Logically the switch works on the value of a variable, not directly on it. Thats why we specify it for the case. PHP (unlike most languages) will actually allow strings in its switch statements.
Also note that switches are loose in comparison.
PHP Code:
$a = 4;
switch ($a)
{
case "4":
print '$a is 4';
break;
}
That will print that $a is 4.
Edit:
I should clarify as well, I consider the loose comparison to be a negative.