3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $constants = get_defined_constants(true); $json_errors = array(); foreach ($constants["json"] as $name => $value) { if (!strncmp($name, "JSON_ERROR_", 11)) { $json_errors[$value] = $name; } } var_dump($json_errors);
Output for 7.0.0 - 7.1.0
array(11) { [0]=> string(15) "JSON_ERROR_NONE" [1]=> string(16) "JSON_ERROR_DEPTH" [2]=> string(25) "JSON_ERROR_STATE_MISMATCH" [3]=> string(20) "JSON_ERROR_CTRL_CHAR" [4]=> string(17) "JSON_ERROR_SYNTAX" [5]=> string(15) "JSON_ERROR_UTF8" [6]=> string(20) "JSON_ERROR_RECURSION" [7]=> string(21) "JSON_ERROR_INF_OR_NAN" [8]=> string(27) "JSON_ERROR_UNSUPPORTED_TYPE" [9]=> string(32) "JSON_ERROR_INVALID_PROPERTY_NAME" [10]=> string(16) "JSON_ERROR_UTF16" }
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: json in /in/8Rjd1 on line 4 Warning: Invalid argument supplied for foreach() in /in/8Rjd1 on line 8 array(0) { }
Output for 5.5.0 - 5.6.28
array(9) { [0]=> string(15) "JSON_ERROR_NONE" [1]=> string(16) "JSON_ERROR_DEPTH" [2]=> string(25) "JSON_ERROR_STATE_MISMATCH" [3]=> string(20) "JSON_ERROR_CTRL_CHAR" [4]=> string(17) "JSON_ERROR_SYNTAX" [5]=> string(15) "JSON_ERROR_UTF8" [6]=> string(20) "JSON_ERROR_RECURSION" [7]=> string(21) "JSON_ERROR_INF_OR_NAN" [8]=> string(27) "JSON_ERROR_UNSUPPORTED_TYPE" }
Output for 5.3.3 - 5.4.45
array(6) { [0]=> string(15) "JSON_ERROR_NONE" [1]=> string(16) "JSON_ERROR_DEPTH" [2]=> string(25) "JSON_ERROR_STATE_MISMATCH" [3]=> string(20) "JSON_ERROR_CTRL_CHAR" [4]=> string(17) "JSON_ERROR_SYNTAX" [5]=> string(15) "JSON_ERROR_UTF8" }
Output for 5.3.0 - 5.3.2
array(5) { [0]=> string(15) "JSON_ERROR_NONE" [1]=> string(16) "JSON_ERROR_DEPTH" [2]=> string(25) "JSON_ERROR_STATE_MISMATCH" [3]=> string(20) "JSON_ERROR_CTRL_CHAR" [4]=> string(17) "JSON_ERROR_SYNTAX" }
Output for 5.2.1 - 5.2.17
Notice: Undefined index: json in /in/8Rjd1 on line 4 Warning: Invalid argument supplied for foreach() in /in/8Rjd1 on line 4 array(0) { }
Output for 5.0.0 - 5.2.0
Warning: Invalid argument supplied for foreach() in /in/8Rjd1 on line 4 array(0) { }
Output for 4.3.0 - 4.3.10, 4.4.0 - 4.4.9
Warning: Wrong parameter count for get_defined_constants() in /in/8Rjd1 on line 2 Warning: Invalid argument supplied for foreach() in /in/8Rjd1 on line 4 array(0) { }
Output for 4.3.11
Warning: Wrong parameter count for get_defined_constants() in /in/8Rjd1 on line 2 array(0) { }