3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "'string'"; json_decode("'string'"); var_dump(json_last_error(), json_last_error_msg()); echo "100"; json_decode("100"); // int var_dump(json_last_error(), json_last_error_msg()); echo "1."; json_decode("1."); // float var_dump(json_last_error(), json_last_error_msg()); echo "1.0"; json_decode("1.0"); // float var_dump(json_last_error(), json_last_error_msg()); echo ".5"; json_decode(".5"); // float var_dump(json_last_error(), json_last_error_msg()); echo "true"; json_decode("true"); // bool var_dump(json_last_error(), json_last_error_msg());
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
'string'int(4) string(12) "Syntax error" 100int(0) string(8) "No error" 1.int(4) string(12) "Syntax error" 1.0int(0) string(8) "No error" .5int(4) string(12) "Syntax error" trueint(0) string(8) "No error"
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
'string'int(4) string(12) "Syntax error" 100int(0) string(8) "No error" 1.int(0) string(8) "No error" 1.0int(0) string(8) "No error" .5int(0) string(8) "No error" trueint(0) string(8) "No error"

preferences:
45.48 ms | 407 KiB | 5 Q