3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_list= array("Jan 2016"=>2, "Feb 2016"=>4, "Mar 2016"=>2,"Apr 2016"=>0, "Jan 2017"=>9,"Feb 2017"=>2,"Mar 2017"=>5,"Jan 2018"=>4,"Feb 2018"=>6); foreach(array_keys($array_list) as $key){ $years[] = explode(" ", $key)[1]; } foreach(array_unique($years) as $year){ $res[$year] = array_sum(array_intersect_key(array_values($array_list), array_intersect($years, [$year]))); } var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [2016]=> int(8) [2017]=> int(16) [2018]=> int(10) }

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