3v4l.org

run code in 300+ PHP versions simultaneously
<?php $originArr=array( array('amount'=>100,'date'=>'2014-03-29'), array('amount'=>120,'date'=>'2014-03-30'), array('amount'=>200,'date'=>'2014-03-31') ); $newArr1 = array(); $newArr2 = array(); $tempArr = array(); $resultArr = array(); foreach($originArr as $el) { $newArr1[$el['date']] = $el['amount']; } foreach ($newArr1 as $k1 => $v1) { foreach ($newArr1 as $k2 => $v2) { $v1 += ($k1 > $k2) ? $v2 : 0; } $newArr2[$k1] = $v1; } foreach($newArr2 as $key => $value) { $tempArr['amount'] = $value; $tempArr['date'] = $key; $resultArr[] = $tempArr; }
Output for git.master, git.master_jit, rfc.property-hooks

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