3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r(array( 'JSON_ERROR_NONE' => JSON_ERROR_NONE, 'JSON_ERROR_DEPTH' => JSON_ERROR_DEPTH, 'JSON_ERROR_STATE_MISMATCH' => JSON_ERROR_STATE_MISMATCH, 'JSON_ERROR_CTRL_CHAR' => JSON_ERROR_CTRL_CHAR, 'JSON_ERROR_SYNTAX' => JSON_ERROR_SYNTAX, 'JSON_ERROR_UTF8' => JSON_ERROR_UTF8, 'JSON_ERROR_RECURSION' => JSON_ERROR_RECURSION, 'JSON_ERROR_INF_OR_NAN' => JSON_ERROR_INF_OR_NAN, 'JSON_ERROR_UNSUPPORTED_TYPE' => JSON_ERROR_UNSUPPORTED_TYPE )); echo json_encode('"test":""');
based on e5Mbr
Output for 5.5.0 - 7.2.6
Array ( [JSON_ERROR_NONE] => 0 [JSON_ERROR_DEPTH] => 1 [JSON_ERROR_STATE_MISMATCH] => 2 [JSON_ERROR_CTRL_CHAR] => 3 [JSON_ERROR_SYNTAX] => 4 [JSON_ERROR_UTF8] => 5 [JSON_ERROR_RECURSION] => 6 [JSON_ERROR_INF_OR_NAN] => 7 [JSON_ERROR_UNSUPPORTED_TYPE] => 8 ) "\"test\":\"\""
Output for 5.3.3 - 5.4.45
Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => 0 [JSON_ERROR_DEPTH] => 1 [JSON_ERROR_STATE_MISMATCH] => 2 [JSON_ERROR_CTRL_CHAR] => 3 [JSON_ERROR_SYNTAX] => 4 [JSON_ERROR_UTF8] => 5 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) "\"test\":\"\""
Output for 5.3.0 - 5.3.2
Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => 0 [JSON_ERROR_DEPTH] => 1 [JSON_ERROR_STATE_MISMATCH] => 2 [JSON_ERROR_CTRL_CHAR] => 3 [JSON_ERROR_SYNTAX] => 4 [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) "\"test\":\"\""
Output for 5.2.0 - 5.2.17
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/0loge on line 4 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/0loge on line 5 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/0loge on line 6 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/0loge on line 7 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/0loge on line 8 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => JSON_ERROR_NONE [JSON_ERROR_DEPTH] => JSON_ERROR_DEPTH [JSON_ERROR_STATE_MISMATCH] => JSON_ERROR_STATE_MISMATCH [JSON_ERROR_CTRL_CHAR] => JSON_ERROR_CTRL_CHAR [JSON_ERROR_SYNTAX] => JSON_ERROR_SYNTAX [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) "\"test\":\"\""
Output for 5.0.0 - 5.1.6
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/0loge on line 4 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/0loge on line 5 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/0loge on line 6 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/0loge on line 7 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/0loge on line 8 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => JSON_ERROR_NONE [JSON_ERROR_DEPTH] => JSON_ERROR_DEPTH [JSON_ERROR_STATE_MISMATCH] => JSON_ERROR_STATE_MISMATCH [JSON_ERROR_CTRL_CHAR] => JSON_ERROR_CTRL_CHAR [JSON_ERROR_SYNTAX] => JSON_ERROR_SYNTAX [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) Fatal error: Call to undefined function json_encode() in /in/0loge on line 15
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/0loge on line 4 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/0loge on line 5 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/0loge on line 6 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/0loge on line 7 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/0loge on line 8 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => JSON_ERROR_NONE [JSON_ERROR_DEPTH] => JSON_ERROR_DEPTH [JSON_ERROR_STATE_MISMATCH] => JSON_ERROR_STATE_MISMATCH [JSON_ERROR_CTRL_CHAR] => JSON_ERROR_CTRL_CHAR [JSON_ERROR_SYNTAX] => JSON_ERROR_SYNTAX [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) Fatal error: Call to undefined function: json_encode() in /in/0loge on line 15
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/0loge on line 4 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/0loge on line 5 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/0loge on line 6 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/0loge on line 7 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/0loge on line 8 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => JSON_ERROR_NONE [JSON_ERROR_DEPTH] => JSON_ERROR_DEPTH [JSON_ERROR_STATE_MISMATCH] => JSON_ERROR_STATE_MISMATCH [JSON_ERROR_CTRL_CHAR] => JSON_ERROR_CTRL_CHAR [JSON_ERROR_SYNTAX] => JSON_ERROR_SYNTAX [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) Fatal error: Call to undefined function: json_encode() in /in/0loge on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant JSON_ERROR_NONE - assumed 'JSON_ERROR_NONE' in /in/0loge on line 4 Notice: Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in /in/0loge on line 5 Notice: Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in /in/0loge on line 6 Notice: Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in /in/0loge on line 7 Notice: Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in /in/0loge on line 8 Notice: Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in /in/0loge on line 9 Notice: Use of undefined constant JSON_ERROR_RECURSION - assumed 'JSON_ERROR_RECURSION' in /in/0loge on line 10 Notice: Use of undefined constant JSON_ERROR_INF_OR_NAN - assumed 'JSON_ERROR_INF_OR_NAN' in /in/0loge on line 11 Notice: Use of undefined constant JSON_ERROR_UNSUPPORTED_TYPE - assumed 'JSON_ERROR_UNSUPPORTED_TYPE' in /in/0loge on line 13 Array ( [JSON_ERROR_NONE] => JSON_ERROR_NONE [JSON_ERROR_DEPTH] => JSON_ERROR_DEPTH [JSON_ERROR_STATE_MISMATCH] => JSON_ERROR_STATE_MISMATCH [JSON_ERROR_CTRL_CHAR] => JSON_ERROR_CTRL_CHAR [JSON_ERROR_SYNTAX] => JSON_ERROR_SYNTAX [JSON_ERROR_UTF8] => JSON_ERROR_UTF8 [JSON_ERROR_RECURSION] => JSON_ERROR_RECURSION [JSON_ERROR_INF_OR_NAN] => JSON_ERROR_INF_OR_NAN [JSON_ERROR_UNSUPPORTED_TYPE] => JSON_ERROR_UNSUPPORTED_TYPE ) Fatal error: Call to undefined function: json_encode() in /in/0loge on line 15