|
is_numericFinds whether a variable is a number or a numeric string Description
bool is_numeric(mixed
$value )Determines if the given variable is a number or a numeric string. Parameters
Return Values
Returns Changelog
Examples
Example #1 is_numeric examples
The above example will output: '42' is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337.0 is numeric '0x539' is NOT numeric '02471' is numeric '0b10100111001' is NOT numeric '1337e0' is numeric 'not numeric' is NOT numeric array ( ) is NOT numeric 9.1 is numeric NULL is NOT numeric '' is NOT numeric
Example #2 is_numeric with whitespace
Output of the above example in PHP 8: ' 42' is numeric '42 ' is numeric ' 9001' is NOT numeric '9001 ' is NOT numeric Output of the above example in PHP 7: ' 42' is numeric '42 ' is NOT numeric ' 9001' is NOT numeric '9001 ' is NOT numeric See Also
|