3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bigger_than_max = '{"max": ' . PHP_INT_MAX . '1}'; var_dump($bigger_than_max); var_dump(json_decode($bigger_than_max)); var_dump(json_decode($bigger_than_max, false, 512, JSON_BIGINT_AS_STRING)); var_dump(json_encode(json_decode($bigger_than_max, false, 512, JSON_BIGINT_AS_STRING))); var_dump(json_encode(json_decode($bigger_than_max, false, 512, JSON_BIGINT_AS_STRING), JSON_NUMERIC_CHECK));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.223372036854776E+19) } object(stdClass)#1 (1) { ["max"]=> string(20) "92233720368547758071" } string(30) "{"max":"92233720368547758071"}" string(29) "{"max":9.223372036854776e+19}"
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.223372036854776E+19) } object(stdClass)#1 (1) { ["max"]=> string(20) "92233720368547758071" } string(30) "{"max":"92233720368547758071"}" string(29) "{"max":9.223372036854776e+19}"
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.2233720368548E+19) } object(stdClass)#1 (1) { ["max"]=> string(20) "92233720368547758071" } string(30) "{"max":"92233720368547758071"}" string(29) "{"max":9.223372036854776e+19}"
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.2233720368548E+19) } object(stdClass)#1 (1) { ["max"]=> string(20) "92233720368547758071" } string(30) "{"max":"92233720368547758071"}" string(27) "{"max":9.2233720368548e+19}"
Output for 5.3.3 - 5.3.29
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.2233720368548E+19) } Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 6 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 6 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 8 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 8 string(4) "null" Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 9 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 9 string(4) "null"
Output for 5.3.0 - 5.3.2
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.2233720368548E+19) } Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 6 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 6 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 8 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 8 string(4) "null" Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 9 Warning: json_decode() expects at most 3 parameters, 4 given in /in/lHL62 on line 9 Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/lHL62 on line 9 Warning: json_encode() expects parameter 2 to be long, string given in /in/lHL62 on line 9 NULL
Output for 5.2.4 - 5.2.17
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> float(9.2233720368548E+19) } Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 6 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 6 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 8 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 8 string(4) "null" Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 9 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 9 Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/lHL62 on line 9 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/lHL62 on line 9 NULL
Output for 5.2.0 - 5.2.3
string(29) "{"max": 92233720368547758071}" object(stdClass)#1 (1) { ["max"]=> int(9223372036854775807) } Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 6 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 6 NULL Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 8 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 8 string(4) "null" Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/lHL62 on line 9 Warning: json_decode() expects at most 2 parameters, 4 given in /in/lHL62 on line 9 Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/lHL62 on line 9 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/lHL62 on line 9 NULL
Output for 5.0.5, 5.1.0 - 5.1.6
string(29) "{"max": 92233720368547758071}" Fatal error: Call to undefined function json_decode() in /in/lHL62 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.4
Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/lHL62 on line 3 string(21) "{"max": PHP_INT_MAX1}" Fatal error: Call to undefined function json_decode() in /in/lHL62 on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
string(29) "{"max": 92233720368547758071}" Fatal error: Call to undefined function: json_decode() in /in/lHL62 on line 5
Process exited with code 255.
Output for 4.4.0 - 4.4.4
string(29) "{"max": 92233720368547758071}" Fatal error: Call to undefined function: json_decode() in /in/lHL62 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.11
Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/lHL62 on line 3 string(21) "{"max": PHP_INT_MAX1}" Fatal error: Call to undefined function: json_decode() in /in/lHL62 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/lHL62 on line 3 string(21) "{"max": PHP_INT_MAX1}" Fatal error: Call to undefined function: json_decode() in /in/lHL62 on line 5

preferences:
329.51 ms | 402 KiB | 461 Q