3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rcr(array $ids): array { $array = []; foreach ($ids as $id) { $array[$id] = rcr(getSubIds($id)); } return $array; } function getSubIds(int $id): array { switch ($id) { case 2: return [5, 108]; case 5: return [7]; case 7: return [46]; case 8: return [72]; default: return []; } } print_r(rcr([2, 14, 8]));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [2] => Array ( [5] => Array ( [7] => Array ( [46] => Array ( ) ) ) [108] => Array ( ) ) [14] => Array ( ) [8] => Array ( [72] => Array ( ) ) )

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:
35.15 ms | 402 KiB | 8 Q