3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = [ [ 'messageId' => '5ACE9D8841', 'sender' => 'john@doe.com' ], [ 'messageId' => '7EE67D8170', 'sender' => 'dan@doe.com' ], [ 'messageId' => '8095FD8836', 'sender' => 'cat@doe.com' ], [ 'messageId' => '7EE67D8170', 'dest' => 'mitch@doe.com', 'status' => 'sent', 'date' => '2021-02-01 11:06:55' ] ]; var_export( array_reduce( $myarray, function($result, $row) { static $ref; if (!isset($ref[$row['messageId']])) { $ref[$row['messageId']] = $row; $result[] = &$ref[$row['messageId']]; } else { $ref[$row['messageId']] += $row; } return $result; } ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'messageId' => '5ACE9D8841', 'sender' => 'john@doe.com', ), 1 => array ( 'messageId' => '7EE67D8170', 'sender' => 'dan@doe.com', 'dest' => 'mitch@doe.com', 'status' => 'sent', 'date' => '2021-02-01 11:06:55', ), 2 => array ( 'messageId' => '8095FD8836', 'sender' => 'cat@doe.com', ), )

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:
29.53 ms | 402 KiB | 8 Q