3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array( array('amount'=>100,'date'=>'2014-03-29'), array('amount'=>200,'date'=>'2014-03-31'), array('amount'=>120,'date'=>'2014-03-30'), ); $total = 0; //以日期递增排序 uasort($arr, function($a, $b) { return strtotime($a['date']) - strtotime($b['date']); }); array_walk_recursive($arr, function(&$val, $key) use (&$total) { if ($key === 'amount') { $total += $val; $val = $total; } });var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(2) { ["amount"]=> int(100) ["date"]=> string(10) "2014-03-29" } [2]=> array(2) { ["amount"]=> int(220) ["date"]=> string(10) "2014-03-30" } [1]=> array(2) { ["amount"]=> int(420) ["date"]=> string(10) "2014-03-31" } }

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:
63.35 ms | 402 KiB | 8 Q