3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (!function_exists('json_last_error_msg')) { function json_last_error_msg() { static $errors = array( JSON_ERROR_NONE => null, JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded' ); $error = json_last_error(); return array_key_exists($error, $errors) ? $errors[$error] : "Unknown error ({$error})"; } } echo json_decode("2014-06-06"); echo json_last_error_msg(); ?>
Output for 5.5.24 - 7.2.0
Syntax error
Output for 5.3.3 - 5.4.45
Syntax error, malformed JSON
Output for 5.3.0 - 5.3.2
Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/HuGvq on line 12 Syntax error, malformed JSON
Output for 5.2.0, 5.2.9 - 5.2.17
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/HuGvq on line 12 Fatal error: Call to undefined function json_last_error() in /in/HuGvq on line 13
Process exited with code 255.
Output for 5.2.1 - 5.2.8
2014-06-06 Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/HuGvq on line 12 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/HuGvq on line 12 Fatal error: Call to undefined function json_last_error() in /in/HuGvq on line 13
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/HuGvq on line 18
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/HuGvq on line 18
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/HuGvq on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/HuGvq on line 18