3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['produkt' => 'blyszczaca', 'model' => 'Normal', 'price' => 27.00, 'qty' => 2], ['blyszczaca', 'Normal', 27.00, 2], ['blyszczaca', 'Normal', 27.00, 2], ['czapkoszal', 'Normal', 41.00, 2], ['czapkoszal', 'Luxury', 45.00, 2], ['czapkoszal', 'Normal', 41.00, 2], ['czapkoszal', 'Normal', 41.00, 1], ['czapkoszal', 'Normal', 41.00, 1], ['etola', 'Wolf', 47.00, 1], ['etola', 'Normal', 39.00, 1], ['etola', 'Normal', 39.00, 1], ]; $result = []; foreach ($array as $row) { $row = array_values($row); $group = "$row[0] $row[1]"; $result[$group] = ($result[$group] ?? 0) + $row[3]; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'blyszczaca Normal' => 6, 'czapkoszal Normal' => 6, 'czapkoszal Luxury' => 2, 'etola Wolf' => 1, 'etola Normal' => 2, )

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