3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON { "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" } } } } JSON; $jsonFile = json_decode($json); function getMathQuestions($jsonFile) { foreach($jsonFile as $val) { if(is_object($val)) { getMathQuestions($val); } else { if(is_array($val)) { getMathQuestions($val); } else { echo $val . "<br>"; } } } } echo getMathQuestions($jsonFile);
Output for git.master, git.master_jit, rfc.property-hooks
Which one is correct team name in NBA?<br>New York Bulls<br>Los Angeles Kings<br>Golden State Warriros<br>Huston Rocket<br>Huston Rocket<br>5 + 7 = ?<br>10<br>11<br>12<br>13<br>12<br>12 - 8 = ?<br>1<br>2<br>3<br>4<br>4<br>

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:
97.97 ms | 406 KiB | 5 Q