note 71132 added to ref.json

From: Date: Mon, 13 Nov 2006 16:31:34 +0000
Subject: note 71132 added to ref.json
Groups: php.notes 
Request: Send a blank email to php-notes+get-119675@lists.php.net to get a copy of this message
I got excited when I saw that there was native JSON support built into PHP (I've been using an external class). Then I found out that the implementation is wrong. If you encode an indexed array you get an object back. Doh. <?php print_r( json_decode( json_encode( array('test1'=>'one','test2'=>'two') ) ) ); ?> Produces: stdClass Object ( [test1] => one [test2] => two ) ---- Server IP: 66.163.161.117 Probable Submitter: 12.3.180.2 ---- Manual Page -- http://www.php.net/manual/en/ref.json.php Edit -- https://master.php.net/note/edit/71132 Del: integrated -- https://master.php.net/note/delete/71132/integrated Del: useless -- https://master.php.net/note/delete/71132/useless Del: bad code -- https://master.php.net/note/delete/71132/bad+code Del: spam -- https://master.php.net/note/delete/71132/spam Del: non-english -- https://master.php.net/note/delete/71132/non-english Del: in docs -- https://master.php.net/note/delete/71132/in+docs Del: other reasons-- https://master.php.net/note/delete/71132 Reject -- https://master.php.net/note/reject/71132 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119675) next »