json_last_error
Returns the last error occurred
&reftitle.description;
intjson_last_error
Returns the last error (if any) occurred during the last JSON encoding/decoding.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns an integer, the value can be one of the following
constants:
JSON error codes
Constant
Meaning
Availability
JSON_ERROR_NONE
No error has occurred
JSON_ERROR_DEPTH
The maximum stack depth has been exceeded
JSON_ERROR_STATE_MISMATCH
Invalid or malformed JSON
JSON_ERROR_CTRL_CHAR
Control character error, possibly incorrectly encoded
JSON_ERROR_SYNTAX
Syntax error
JSON_ERROR_UTF8
Malformed UTF-8 characters, possibly incorrectly encoded
PHP 5.3.3
&reftitle.examples;
json_last_error example
]]>
&example.outputs;
json_last_error with json_encode
]]>
&example.outputs;
&reftitle.seealso;
json_decode
json_encode