note 95805 modified in function.json-encode by danbrown

From: Date: Fri, 22 Jan 2010 15:18:42 +0000
Subject: note 95805 modified in function.json-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165212@lists.php.net to get a copy of this message
Be careful about one thing: With a string key Php will consider it's an object: <?php echo json_encode(array('id'=>'testtext')); echo json_encode(array('testtext')); ?> Will give: {"id":"testtext"} ["testtext"] Beware of the string keys! --was-- Be careful about one thing: With a string key Php will consider it's an object: echo json_encode(array('id'=>'testtext')); echo json_encode(array('testtext')); Will give: {"id":"testtext"} ["testtext"] Beware of the string keys! http://php.net/manual/en/function.json-encode.php

« previous php.notes (#165212) next »