|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-07-05 18:33 UTC] peehaa@php.net
-Status: Open
+Status: Feedback
[2017-07-05 18:33 UTC] peehaa@php.net
[2017-07-06 14:57 UTC] emimarz at gmail dot com
-Status: Feedback
+Status: Open
[2017-07-06 14:57 UTC] emimarz at gmail dot com
[2017-07-06 15:27 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2017-07-06 15:27 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 10:00:02 2025 UTC |
Description: ------------ this unexpected behaviour happen on php 5.* and 7.1 with json_decode Test script: --------------- <?php $son = '{ "1":{ "id":"1", "name":"jack" }, "2":{ "id":"2", "name":"john" } }'; $json = (array) json_decode($son); //var_dump($json); var_dump($json['1']); // incorrect result var_dump($json[1]); // incorrect result $json = json_decode($son,true); var_dump($json['1']); // correct result