note 99325 deleted from function.json-decode by salathe

From: Date: Mon, 21 Sep 2020 15:02:07 +0000
Subject: note 99325 deleted from function.json-decode by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215443@lists.php.net to get a copy of this message
Note Submitter: T erkif ---- it seems, that some of the people are not aware, that if you are using json_decode to decode a string it HAS to be a propper json string: <?php var_dump(json_encode('Hello')); var_dump(json_decode('Hello')); // wrong var_dump(json_decode("Hello")); // wrong var_dump(json_decode('"Hello"')); // correct var_dump(json_decode("'Hello'")); // wrong result: string(7) ""Hello"" NULL NULL string(5) "Hello" NULL

« previous php.notes (#215443) next »