3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = Array ( '0' => Array ( 'id' => 1, 'color' => 'red' ), '1' => Array ( '0' => Array ( 'id' => 2, 'color' => 'blue' ), '1' => Array ( '0' => Array ( 'id' => 3, 'color' => 'green' ) ), '2' => Array ( 'id' => 4, 'color' => 'blue' ) ), '2' => Array ( 'id' => 5, 'color' => 'purple' ) ); $i = 0; array_walk_recursive($a, function($v,$k)use(&$r,&$i){ $r[$i][$k] = $v; ($k == 'color') ? $i++ :$i; }); echo '<pre>'; print_r($r);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [id] => 1 [color] => red ) [1] => Array ( [id] => 2 [color] => blue ) [2] => Array ( [id] => 3 [color] => green ) [3] => Array ( [id] => 4 [color] => blue ) [4] => Array ( [id] => 5 [color] => purple ) )

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