3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tests = array( "42", 1337, 0x539, '0x539', "0x539", 02471, '02471', "02471", 0b10100111001, '0b10100111001', "0b10100111001", ); foreach ($tests as $element) { if (is_numeric($element)) { echo "'{$element}' is considered numeric", PHP_EOL; } else { echo "'{$element}' is not considered numeric", PHP_EOL; } }
based on aWHAf
Output for 7.0.0 - 7.2.0
'42' is considered numeric '1337' is considered numeric '1337' is considered numeric '0x539' is not considered numeric '0x539' is not considered numeric '1337' is considered numeric '02471' is considered numeric '02471' is considered numeric '1337' is considered numeric '0b10100111001' is not considered numeric '0b10100111001' is not considered numeric
Output for 5.5.0 - 5.6.28
'42' is considered numeric '1337' is considered numeric '1337' is considered numeric '0x539' is considered numeric '0x539' is considered numeric '1337' is considered numeric '02471' is considered numeric '02471' is considered numeric '1337' is considered numeric '0b10100111001' is not considered numeric '0b10100111001' is not considered numeric