3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'GB' => 20827, 'US' => 73, 'ES' => 23, 'AU' => 15, 'DE' => 12, 'MY' => 4, 'QA' => 1, 'VN' => 1, 'SK' => 1, 'FJ' => 1, 'ME' => 1, 'TR' => 1, 'LV' => 1 ], [ 'GB' => 15070, 'US' => 3920, 'IE' => 1711, 'PH' => 1071, 'MT' => 578, 'AU' => 423, 'HR' => 241, 'ZA' => 210, 'FR' => 139 ] ]; $result = array_shift($array); foreach ($array as $row) { foreach ($row as $key => $value) { $result[$key] = ($result[$key] ?? 0) + $value; } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'GB' => 35897, 'US' => 3993, 'ES' => 23, 'AU' => 438, 'DE' => 12, 'MY' => 4, 'QA' => 1, 'VN' => 1, 'SK' => 1, 'FJ' => 1, 'ME' => 1, 'TR' => 1, 'LV' => 1, 'IE' => 1711, 'PH' => 1071, 'MT' => 578, 'HR' => 241, 'ZA' => 210, 'FR' => 139, )

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:
130.9 ms | 406 KiB | 5 Q