3v4l.org

run code in 300+ PHP versions simultaneously
<?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.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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 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.0 - 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

preferences:
226.45 ms | 402 KiB | 313 Q