3v4l.org

run code in 300+ PHP versions simultaneously
<?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 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Syntax error
Output for 5.3.3 - 5.3.29, 5.4.0 - 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.0.5, 5.1.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.3.11, 4.4.0 - 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

preferences:
253.41 ms | 401 KiB | 344 Q