3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = json_decode('{"3":{"friend":45,"all":100},"2":{"friend":30,"all":50},"1":{"friend":25,"all":25}}'); var_dump((array) $a); var_dump($a[3]['friend']);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [3]=> object(stdClass)#1 (2) { ["friend"]=> int(45) ["all"]=> int(100) } [2]=> object(stdClass)#3 (2) { ["friend"]=> int(30) ["all"]=> int(50) } [1]=> object(stdClass)#4 (2) { ["friend"]=> int(25) ["all"]=> int(25) } } Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/gMBNj:4 Stack trace: #0 {main} thrown in /in/gMBNj on line 4
Process exited with code 255.

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:
33.23 ms | 401 KiB | 8 Q