|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-19 06:19 UTC] aharvey@php.net
[2012-02-19 06:19 UTC] aharvey@php.net
-Status: Open
+Status: Not a bug
[2012-02-19 15:53 UTC] uginroot at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 09 00:00:02 2025 UTC |
Description: ------------ $product = json_decode('{"name":"Anton","1":"is not null"}'); print_r($product); var_dump($product->name); var_dump($product->{'1'}); $product = (array)$product; print_r($product); var_dump($product['name']); var_dump($product['1']); Test script: --------------- <?php $product = json_decode('{"name":"Anton","1":"is not null"}'); print_r($product); var_dump($product->name); var_dump($product->{'1'}); $product = (array)$product; print_r($product); var_dump($product['name']); var_dump($product['1']); Expected result: ---------------- stdClass Object ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Array ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Actual result: -------------- stdClass Object ( [name] => Anton [1] => is not null ) string(5) "Anton" string(11) "is not null" Array ( [name] => Anton [1] => is not null ) string(5) "Anton" NULL