is_numeric

PHP 4, PHP 5, PHP 7, PHP 8
is_numeric - Finds whether a variable is a number or a numeric string
Manual
Code Examples

Example #1 is_numeric examples

Result: '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
PHP Version:

Example #2 is_numeric with whitespace

Result: ' 42' is numeric '42 ' is numeric ' 9001' is NOT numeric '9001 ' is NOT numeric
PHP Version: