json_last_errorReturns 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 codesConstantMeaningAvailabilityJSON_ERROR_NONENo error has occurredJSON_ERROR_DEPTHThe maximum stack depth has been exceededJSON_ERROR_STATE_MISMATCHInvalid or malformed JSONJSON_ERROR_CTRL_CHARControl character error, possibly incorrectly encodedJSON_ERROR_SYNTAXSyntax errorJSON_ERROR_UTF8Malformed UTF-8 characters, possibly incorrectly encodedPHP 5.3.3JSON_ERROR_RECURSIONOne or more recursive references in the value to be encodedPHP 5.5.0JSON_ERROR_INF_OR_NAN
One or more
NAN
or INF
values in the value to be encoded
PHP 5.5.0JSON_ERROR_UNSUPPORTED_TYPEA value of a type that cannot be encoded was givenPHP 5.5.0
&reftitle.examples;
json_last_error example
]]>
&example.outputs;
json_last_error with json_encode
]]>
&example.outputs;
&reftitle.seealso;
json_last_error_msgjson_decodejson_encode