3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['type' => 'AAA', 'label_id' => 'A1,35'], ['type' => 'AAA', 'label_id' => 'A2,34'], ['type' => 'BBB', 'label_id' => 'B1,29'], ['type' => 'CCC', 'label_id' => 'C1,20'], ['type' => 'CCC', 'label_id' => 'C2,19'], ['type' => 'CCC', 'label_id' => 'C3,18'] ]; var_export( array_values( array_reduce( $array, function($result, $row) { $result[$row['type']]['type'] ??= $row['type']; $result[$row['type']]['label_id'][] = $row['label_id']; return $result; }, [] ) ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'type' => 'AAA', 'label_id' => array ( 0 => 'A1,35', 1 => 'A2,34', ), ), 1 => array ( 'type' => 'BBB', 'label_id' => array ( 0 => 'B1,29', ), ), 2 => array ( 'type' => 'CCC', 'label_id' => array ( 0 => 'C1,20', 1 => 'C2,19', 2 => 'C3,18', ), ), )

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