3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printAll($a, &$output, $prefix = '') { if (!is_array($a) && !is_object($a)) { $prefix = rtrim($prefix, '/'); $output[] = $prefix . ' => ' . $a. "\n"; return; } foreach($a as $k => $v) { $tmp = $prefix; $tmp .= $k . "/"; printAll($v, $output, $tmp); } } $json_str = '{ "one": { "two": 3, "four": [ 5,6,7] }, "eight": { "nine": { "ten":11 } } }'; $object = json_decode($json_str); $res = array(); printAll($object, $res); var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [0]=> string(13) "one/two => 3 " [1]=> string(16) "one/four/0 => 5 " [2]=> string(16) "one/four/1 => 6 " [3]=> string(16) "one/four/2 => 7 " [4]=> string(21) "eight/nine/ten => 11 " }

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