3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [ "total_process_per_category" => "6", "category_id" => "1" ], [ "total_process_per_category" => "2", "category_id" => "2" ] ]; $array2 = [ [ "total_pinned_per_category" => "16", "category_id" => "1" ], [ "total_pinned_per_category" => "4", "category_id" => "2" ] ]; var_export( array_values( array_reduce( array_merge($array1, $array2), function ($result, $row) { $result[$row['category_id']] = ($result[$row['category_id']] ?? []) + $row; return $result; }, [] ) ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'total_process_per_category' => '6', 'category_id' => '1', 'total_pinned_per_category' => '16', ), 1 => array ( 'total_process_per_category' => '2', 'category_id' => '2', 'total_pinned_per_category' => '4', ), )

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