3v4l.org

run code in 300+ PHP versions simultaneously
<?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
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#1 (2) { ["id"]=> string(1) "1" ["name"]=> string(4) "jack" } object(stdClass)#1 (2) { ["id"]=> string(1) "1" ["name"]=> string(4) "jack" } array(2) { ["id"]=> string(1) "1" ["name"]=> string(4) "jack" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
30.63 ms | 402 KiB | 8 Q