3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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.3.0rc1
'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.25
'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.0 - 5.6.30, 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
Output for hhvm-3.18.5 - 3.22.0
'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.1 is numeric NULL is NOT numeric