3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array('num'=>5,'period'=>3), array('num'=>10,'period'=>3), array('num'=>15,'period'=>9) ); $temp = array(); foreach($arr as $item) { list($n, $p) = array_values($item);print_r($p);print_r($n); $temp[$p] = array_key_exists($p, $temp) ? $temp[$p]+$n : $n; } print_r($temp); $arr = array(); foreach($temp as $p => $n) $arr[] = array('num'=>$n, 'period'=>$p); print_r($arr);
Output for git.master_jit, git.master, rfc.property-hooks
35310915Array ( [3] => 15 [9] => 15 ) Array ( [0] => Array ( [num] => 15 [period] => 3 ) [1] => Array ( [num] => 15 [period] => 9 ) )

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:
39.43 ms | 401 KiB | 8 Q