3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => array ( 'MACHINE' => 'A1', 'LOT' => 'B1077', 'slot' => 1 ), 1 => array ( 'MACHINE' => 'A2', 'LOT' => 'B0229', 'slot' => 2 ), 2 => array ( 'MACHINE' => 'A2', 'LOT' => 'B0132', 'slot' => 2 ), 3 => array ( 'MACHINE' => 'A2', 'LOT' => 'B3967', 'slot' => 2 ), 4 => array ( 'MACHINE' => 'A3', 'LOT' => 'B2644', 'slot' => 3 ) ); $temp = array(); foreach ($array as $v) { $key = $v['MACHINE'] . '#' . $v['slot']; if (!isset($temp[$key])) { $temp[$key] = $v; } else { $temp[$key]['Duplicate'][] = $v['LOT']; } } foreach ($temp as &$v) { if (isset($v['Duplicate'])) $v['Duplicate'] = implode(', ', $v['Duplicate']); } $result = array_values($temp); print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [MACHINE] => A1 [LOT] => B1077 [slot] => 1 ) [1] => Array ( [MACHINE] => A2 [LOT] => B0229 [slot] => 2 [Duplicate] => B0132, B3967 ) [2] => Array ( [MACHINE] => A3 [LOT] => B2644 [slot] => 3 ) )

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