note 107616 added to function.json-encode
| From: | webmaster_php at colnect dot com | Date: | Wed, 22 Feb 2012 03:52:50 +0000 |
| Subject: | note 107616 added to function.json-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186268@lists.php.net to get a copy of this message | ||
WARNING! Do not pass associative arrays if the order is important to you. It seems that while
FireFox does keep the same order, both Chrome and IE sort it. Here's a little workaround:
$arWrapper = array();
$arWrapper['k'] = array_keys($arChoices);
$arWrapper['v'] = array_values($arChoices);
$json = json_encode($arWrapper);
----
Server IP: 69.147.83.197
Probable Submitter: 106.77.88.1
----
Manual Page -- http://www.php.net/manual/en/function.json-encode.php
Edit -- https://master.php.net/note/edit/107616
Del: integrated -- https://master.php.net/note/delete/107616/integrated
Del: useless -- https://master.php.net/note/delete/107616/useless
Del: bad code -- https://master.php.net/note/delete/107616/bad+code
Del: spam -- https://master.php.net/note/delete/107616/spam
Del: non-english -- https://master.php.net/note/delete/107616/non-english
Del: in docs -- https://master.php.net/note/delete/107616/in+docs
Del: other reasons-- https://master.php.net/note/delete/107616
Reject -- https://master.php.net/note/reject/107616
Search -- https://master.php.net/manage/user-notes.php