3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array( "42", 1337, 0x539, 02471, 0b10100111001, 1337e0, "not numeric", array(), 9.1, null ); foreach ($tests as $element) { if (is_numeric($element)) { echo var_export($element, true) . " is numeric", PHP_EOL; } else { echo var_export($element, true) . " is NOT numeric", PHP_EOL; } } ?>
Output for 7.1.0 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
'42' is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337.0 is numeric 'not numeric' is NOT numeric array ( ) is NOT numeric 9.1 is numeric NULL is NOT numeric
Output for 7.0.2 - 7.0.33
'42' is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337.0 is numeric 'not numeric' is NOT numeric array ( ) is NOT numeric 9.0999999999999996 is numeric NULL is NOT numeric
Output for 5.6.38 - 5.6.40, 7.0.0 - 7.0.1
'42' is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337 is numeric 1337 is numeric 'not numeric' is NOT numeric array ( ) is NOT numeric 9.0999999999999996 is numeric NULL is NOT numeric

preferences:
220.23 ms | 402 KiB | 225 Q