note 108427 deleted from function.json-decode by danbrown

From: Date: Thu, 10 May 2012 17:00:28 +0000
Subject: note 108427 deleted from function.json-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187631@lists.php.net to get a copy of this message
Note Submitter: jakemayer dot at at gmail dot com ---- Concerning aeternuslibertas at gmail dot com's message: Well, actually it's not safe to check for <?php json_decode($input_json) == NULL ?> since the JSON string can actually be null, but one can use this snippet <?php json_decode($input_json); if(json_last_error()==JSON_ERROR_SYNTAX) { // error Handling } ?> This seems to be the more safe way as it uses the builtin JSON functions to check if a syntax error has occured during decoding the value in question.

« previous php.notes (#187631) next »