3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("a1" => 0, "a2" => 2, "a3" => 1, "b1" => 2, "b2" => 3); $final_array=[]; foreach($array as $key=>$value){ $final_array[$key[0]] = (isset($final_array[$key[0]])) ? $final_array[$key[0]]+$value : $value; } print_r($final_array);
Output for git.master_jit, rfc.property-hooks, git.master
Array ( [a] => 3 [b] => 5 )

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:
74.48 ms | 1808 KiB | 4 Q