json_last_errorReturns the last error occurred Description
int json_last_error
( void
)
Returns the last error (if any) occurred during the last JSON encoding/decoding. ParametersThis function has no parameters. Return ValuesReturns an integer, the value can be one of the following constants:
Examples
Example #1 json_last_error example
<?php The above example will output: Decoding: {"Organization": "PHP Documentation Team"} - No errors Decoding: {'Organization': 'PHP Documentation Team'} - Syntax error, malformed JSON
Example #2 json_last_error with json_encode
<?php The above example will output: string(4) "null" bool(true) See Also
|