3v4l.org

run code in 300+ PHP versions simultaneously
<?php $scores = array( array(1, "allan", 90), array(2, "allan", 85), array(3, "mark", 100), array(4, "jason", 88), array(5, "allan", 92), array(6, "mark", 77), array(7, "mark", 88), array(8, "jason", 90) ); $scores = array_reduce($scores, function ($c, $v) { $name = $v[1]; if (isset($c[$name])) { $c[$name] += $v[2]; } else { $c[$name] = $v[2]; } return $c; }, array()); arsort($scores); echo key($scores);
Output for git.master, git.master_jit, rfc.property-hooks
allan

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