3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = json_decode('{ "quiz": { "sport": { "q1": { "question": "Which one is correct team name in NBA?", "options": [ "New York Bulls", "Los Angeles Kings", "Golden State Warriros", "Huston Rocket" ], "answer": "Huston Rocket" } }, "maths": { "q1": { "question": "5 + 7 = ?", "options": [ "10", "11", "12", "13" ], "answer": "12" }, "q2": { "question": "12 - 8 = ?", "options": [ "1", "2", "3", "4" ], "answer": "4" } } } }'); var_dump($obj); foreach ($obj as $v) { var_dump($v); }
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#7 (1) { ["quiz"]=> object(stdClass)#3 (2) { ["sport"]=> object(stdClass)#2 (1) { ["q1"]=> object(stdClass)#1 (3) { ["question"]=> string(38) "Which one is correct team name in NBA?" ["options"]=> array(4) { [0]=> string(14) "New York Bulls" [1]=> string(17) "Los Angeles Kings" [2]=> string(21) "Golden State Warriros" [3]=> string(13) "Huston Rocket" } ["answer"]=> string(13) "Huston Rocket" } } ["maths"]=> object(stdClass)#5 (2) { ["q1"]=> object(stdClass)#4 (3) { ["question"]=> string(9) "5 + 7 = ?" ["options"]=> array(4) { [0]=> string(2) "10" [1]=> string(2) "11" [2]=> string(2) "12" [3]=> string(2) "13" } ["answer"]=> string(2) "12" } ["q2"]=> object(stdClass)#6 (3) { ["question"]=> string(10) "12 - 8 = ?" ["options"]=> array(4) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" [3]=> string(1) "4" } ["answer"]=> string(1) "4" } } } } object(stdClass)#3 (2) { ["sport"]=> object(stdClass)#2 (1) { ["q1"]=> object(stdClass)#1 (3) { ["question"]=> string(38) "Which one is correct team name in NBA?" ["options"]=> array(4) { [0]=> string(14) "New York Bulls" [1]=> string(17) "Los Angeles Kings" [2]=> string(21) "Golden State Warriros" [3]=> string(13) "Huston Rocket" } ["answer"]=> string(13) "Huston Rocket" } } ["maths"]=> object(stdClass)#5 (2) { ["q1"]=> object(stdClass)#4 (3) { ["question"]=> string(9) "5 + 7 = ?" ["options"]=> array(4) { [0]=> string(2) "10" [1]=> string(2) "11" [2]=> string(2) "12" [3]=> string(2) "13" } ["answer"]=> string(2) "12" } ["q2"]=> object(stdClass)#6 (3) { ["question"]=> string(10) "12 - 8 = ?" ["options"]=> array(4) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" [3]=> string(1) "4" } ["answer"]=> string(1) "4" } } }

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:
90.37 ms | 416 KiB | 5 Q