3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "Strings representing numbers automatically turned into numbers".php_eol; $numbers = array('+123123', '-123123', '1.2e3', '0.00001'); var_dump( $numbers, json_encode($numbers, JSON_NUMERIC_CHECK) ); echo "Strings containing improperly formatted numbers".PHP_EOL; $strings = array('+a33123456789', 'a123'); var_dump( $strings, json_encode($strings, JSON_NUMERIC_CHECK) ); ?>
based on I1h1j
Output for 7.2.0
Warning: Use of undefined constant php_eol - assumed 'php_eol' (this will throw an Error in a future version of PHP) in /in/hKn3q on line 2 Strings representing numbers automatically turned into numbersphp_eolarray(4) { [0]=> string(7) "+123123" [1]=> string(7) "-123123" [2]=> string(5) "1.2e3" [3]=> string(7) "0.00001" } string(28) "[123123,-123123,1200,1.0e-5]" Strings containing improperly formatted numbers array(2) { [0]=> string(13) "+a33123456789" [1]=> string(4) "a123" } string(24) "["+a33123456789","a123"]"
Output for 5.5.0 - 7.1.10
Notice: Use of undefined constant php_eol - assumed 'php_eol' in /in/hKn3q on line 2 Strings representing numbers automatically turned into numbersphp_eolarray(4) { [0]=> string(7) "+123123" [1]=> string(7) "-123123" [2]=> string(5) "1.2e3" [3]=> string(7) "0.00001" } string(28) "[123123,-123123,1200,1.0e-5]" Strings containing improperly formatted numbers array(2) { [0]=> string(13) "+a33123456789" [1]=> string(4) "a123" } string(24) "["+a33123456789","a123"]"