3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo PHP_INT_SIZE . "\n\n"; $json = '1'; $jsons = array( '1', '2147483647', # 32bit max INT '9223372036854775807', # 64bit max INT '99999999999999999999', # something more than 64 bits ); echo "As INT\n------\n"; foreach ($jsons as $json) { var_dump(json_decode($json, FALSE, 512)); } echo "\n"; echo "As STRING\n---------\n"; foreach ($jsons as $json) { var_dump(json_decode($json, FALSE, 512, JSON_BIGINT_AS_STRING)); }
Output for 5.4.11 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
8 As INT ------ int(1) int(2147483647) int(9223372036854775807) float(1.0E+20) As STRING --------- int(1) int(2147483647) int(9223372036854775807) string(20) "99999999999999999999"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.0 - 5.4.10
8 As INT ------ int(1) int(2147483647) int(9223372036854775807) float(1.0E+20) As STRING --------- int(1) int(2147483647) int(9223372036854775807) float(1.0E+20)
Output for 5.3.0 - 5.3.29
8 As INT ------ int(1) int(2147483647) int(9223372036854775807) float(1.0E+20) As STRING --------- Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 3 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 3 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 3 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 3 parameters, 4 given in /in/A7pMp on line 23 NULL
Output for 5.2.0 - 5.2.17
8 As INT ------ Warning: json_decode() expects at most 2 parameters, 3 given in /in/A7pMp on line 16 NULL Warning: json_decode() expects at most 2 parameters, 3 given in /in/A7pMp on line 16 NULL Warning: json_decode() expects at most 2 parameters, 3 given in /in/A7pMp on line 16 NULL Warning: json_decode() expects at most 2 parameters, 3 given in /in/A7pMp on line 16 NULL As STRING --------- Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 2 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 2 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 2 parameters, 4 given in /in/A7pMp on line 23 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/A7pMp on line 23 Warning: json_decode() expects at most 2 parameters, 4 given in /in/A7pMp on line 23 NULL
Output for 5.0.5 - 5.1.6
8 As INT ------ Fatal error: Call to undefined function json_decode() in /in/A7pMp on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.4
Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/A7pMp on line 3 PHP_INT_SIZE As INT ------ Fatal error: Call to undefined function json_decode() in /in/A7pMp on line 16
Process exited with code 255.
Output for 4.4.5 - 4.4.9
8 As INT ------ Fatal error: Call to undefined function: json_decode() in /in/A7pMp on line 16
Process exited with code 255.
Output for 4.4.0 - 4.4.4
8 As INT ------ Fatal error: Call to undefined function: json_decode() in /in/A7pMp on line 16
Process exited with code 255.
Output for 4.3.2 - 4.3.11
Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/A7pMp on line 3 PHP_INT_SIZE As INT ------ Fatal error: Call to undefined function: json_decode() in /in/A7pMp on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/A7pMp on line 3 PHP_INT_SIZE As INT ------ Fatal error: Call to undefined function: json_decode() in /in/A7pMp on line 16