3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a1 = [ ['id' => 5, 'cnt' => 14], ['id' => 8, 'cnt' => 2], ]; $a2 = [ ['id' => 8, 'binding' => 'hardcover'], ['id' => 5, 'binding' => 'softcover'], ]; $result = []; foreach (array_merge($a1, $a2) as $row) { $result[$row['id']] = ($result[$row['id']] ?? []) + $row; } var_export(array_values($result));
Output for git.master_jit, git.master, rfc.property-hooks
array ( 0 => array ( 'id' => 5, 'cnt' => 14, 'binding' => 'softcover', ), 1 => array ( 'id' => 8, 'cnt' => 2, 'binding' => 'hardcover', ), )

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