3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [1, 2014, 'context' => 'aaa'], [12, 2014, 'context' => 'aaa'], [5, 2014, 'context' => 'zzz'], ]; foreach ($array as $i => &$row) { if (!isset($ref[$row['context']])) { $ref[$row['context']] = &$row[0]; } else { $ref[$row['context']] += $row[0]; unset($array[$i]); } } var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 13, 1 => 2014, 'context' => 'aaa', ), 2 => array ( 0 => 5, 1 => 2014, 'context' => 'zzz', ), )

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