3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( '0' => array( 'names' => array(0 => 'Apple'), 'group' => 1 ), '1' => array( 'names' => array(0 => 'Mango'), 'group' => 1 ), '2' => array( 'names' => array(0 => 'Grapes'), 'group' => 1 ), '3' => array( 'names' => array(0 => 'Tomato'), 'group' => 2 ), '4' => array( 'names' => array(0 => 'Potato', 1 => 'Monkeywrench'), 'group' => 2 ) ); foreach ($array as $row) { if (!isset($result[$row['group']])) { $result[$row['group']] = $row; } else { array_push($result[$row['group']]['names'], ...$row['names']); } } var_export(array_values($result));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'names' => array ( 0 => 'Apple', 1 => 'Mango', 2 => 'Grapes', ), 'group' => 1, ), 1 => array ( 'names' => array ( 0 => 'Tomato', 1 => 'Potato', 2 => 'Monkeywrench', ), 'group' => 2, ), )

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:
52.96 ms | 401 KiB | 8 Q