3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "'string'\n"; json_decode("'string'"); var_dump(json_last_error(), json_last_error_msg()); echo "\n"; echo "100\n"; json_decode("100"); // int var_dump(json_last_error(), json_last_error_msg()); echo "\n"; echo "1.\n"; json_decode("1."); // float var_dump(json_last_error(), json_last_error_msg()); echo "\n"; echo "1.0\n"; json_decode("1.0"); // float var_dump(json_last_error(), json_last_error_msg()); echo "\n"; echo ".5\n"; json_decode(".5"); // float var_dump(json_last_error(), json_last_error_msg()); echo "\n"; echo "true\n"; json_decode("true"); // bool var_dump(json_last_error(), json_last_error_msg());
Output for 7.0.0 - 7.2.0
'string' int(4) string(12) "Syntax error" 100 int(0) string(8) "No error" 1. int(4) string(12) "Syntax error" 1.0 int(0) string(8) "No error" .5 int(4) string(12) "Syntax error" true int(0) string(8) "No error"
Output for 5.5.24 - 5.6.28
'string' int(4) string(12) "Syntax error" 100 int(0) string(8) "No error" 1. int(0) string(8) "No error" 1.0 int(0) string(8) "No error" .5 int(0) string(8) "No error" true int(0) string(8) "No error"
Output for 5.3.20 - 5.4.45
'string' Fatal error: Call to undefined function json_last_error_msg() in /in/KmYtJ on line 5
Process exited with code 255.