As I found out, many of these helper functions are really necessary because PHP is not very typed. I posted a similar question (albeit not one that is similar) to isset earlier this week. It should be noted that PHP will change your string to its integer value for comparison in some cases (if there are mixed types). This cannot be ignored. I think this is a strong argument foris_numeric
from PHP manual
If you are comparing a number with a string or the comparison includes numerical strings, then each string is converted to a number and the comparison is performed numerically. These rules also apply to the switch statement. Type conversion does not require space when comparing === or! ==, as this includes a comparison of the type as well as the value.
, , , " 0" PHP. . . , false, .. .
:
:
$whatami='beast';
($whatami<5) ? echo 'less than 5' : echo 'more than 5';
PHP "" , . . - , :
$whatami='beauty';
if(is_numeric($whatami){
($whatami<5) ? echo 'less than 5' : echo 'more than 5';
} else {
exit('what, am I not pretty enough for a beast?');
}
( ).