3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [1, 2, 2, 3]; $array2 = [10, 20, 30, 50]; $array_sum1 = []; foreach ($array1 as $key => $value) { $array_sum1[$value][] = $array2[$key]; } $array_sum1 = array_map("array_sum", $array_sum1); print_r($array_sum1); $array3 = [4, 4, 4, 6]; $array4 = [10, 20, 30, 50]; $array_sum2 = []; foreach ($array3 as $key => $value) { $array_sum2[$value][] = $array4[$key]; } $array_sum2 = array_map("array_sum", $array_sum2); print_r($array_sum2);die;
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1] => 10 [2] => 50 [3] => 50 ) Array ( [4] => 60 [6] => 50 )

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