3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => [ 'b1' => [ 'c1' => [ 'e1' => 4, 'f1' => 5, 'g1' => 6, ], 'd1' => [ 'e11' => 4, 'f11' => 5, 'g11' => 6, ] ], 'b2' => [ 'c2' => [ 'e2' => 4, 'f2' => 5, 'g2' => 6, ], 'd2' => [ 'e21' => 4, 'f21' => 5, 'g21' => 6, ] ], ] ]; function reverse_recursively($arrayInput) { foreach ($arrayInput as $key => $input) { if (is_array($input)) { $arrayInput[$key] = reverse_recursively($input); } } return array_reverse($arrayInput); } echo '<pre>'; print_r($array); echo '<br>'; print_r(reverse_recursively($array));
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [a] => Array ( [b1] => Array ( [c1] => Array ( [e1] => 4 [f1] => 5 [g1] => 6 ) [d1] => Array ( [e11] => 4 [f11] => 5 [g11] => 6 ) ) [b2] => Array ( [c2] => Array ( [e2] => 4 [f2] => 5 [g2] => 6 ) [d2] => Array ( [e21] => 4 [f21] => 5 [g21] => 6 ) ) ) ) <br>Array ( [a] => Array ( [b2] => Array ( [d2] => Array ( [g21] => 6 [f21] => 5 [e21] => 4 ) [c2] => Array ( [g2] => 6 [f2] => 5 [e2] => 4 ) ) [b1] => Array ( [d1] => Array ( [g11] => 6 [f11] => 5 [e11] => 4 ) [c1] => Array ( [g1] => 6 [f1] => 5 [e1] => 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:
29.9 ms | 411 KiB | 5 Q