3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["cust_id" => 1006, "no_of_subs" => 2, "dlv_id" => 1000], ["cust_id" => 1011, "no_of_subs" => 3, "dlv_id" => 1000], ["cust_id" => 1012, "no_of_subs" => 5, "dlv_id" => 1001], ["cust_id" => 1013, "no_of_subs" => 6, "dlv_id" => 1001] ]; foreach ($array as $row) { if (!isset($result[$row["dlv_id"]])) { $result[$row["dlv_id"]] = ["dlv_id" => $row["dlv_id"], "no_of_subs" => $row["no_of_subs"]]; } else { $result[$row["dlv_id"]]["no_of_subs"] += $row["no_of_subs"]; } } var_export(array_values($result));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'dlv_id' => 1000, 'no_of_subs' => 5, ), 1 => array ( 'dlv_id' => 1001, 'no_of_subs' => 11, ), )

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:
34.52 ms | 405 KiB | 5 Q