3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array ('location' => 'X33', 'usernumber' => 1, 'order' => 'XX', 'part_number' => 'Hi' ), array ('location' => 'X33', 'usernumber' => 1, 'order' => 'XX', 'part_number' => '68730' ), array ('location' => 'W33', 'usernumber' => 2, 'order' => 'YY', 'part_number' => '68741' ), array ('location' => 'W33', 'usernumber' => 2, 'order' => 'YY', 'part_number' => 'Hello' ) ); $out = array(); $index = $arr[0]['usernumber']; foreach($arr as $val){ if($index != $val['usernumber']) $index = $val['usernumber']; $out[$index][] = $val; } echo '<pre>'; print_r($out);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [1] => Array ( [0] => Array ( [location] => X33 [usernumber] => 1 [order] => XX [part_number] => Hi ) [1] => Array ( [location] => X33 [usernumber] => 1 [order] => XX [part_number] => 68730 ) ) [2] => Array ( [0] => Array ( [location] => W33 [usernumber] => 2 [order] => YY [part_number] => 68741 ) [1] => Array ( [location] => W33 [usernumber] => 2 [order] => YY [part_number] => Hello ) ) )

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:
163.81 ms | 408 KiB | 5 Q