3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array ( 0 => array ( 'total_price' => '19.120000', 'total_percent' => '0.20', 'vat_code' => 22, 'discount_percent' => '3.82', ), 1 => array ( 'total_price' => '58.000000', 'total_percent' => '0.60', 'vat_code' => 22, 'discount_percent' => '11.60', ), 2 => array ( 'total_price' => '20.000000', 'total_percent' => '0.21', 'vat_code' => 4, 'discount_percent' => '4.00', ), ); foreach($a as $v){ isset($group[$v['vat_code']]) ? ($group[$v['vat_code']]['total_price'] += $v['total_price'] AND $group[$v['vat_code']]['total_percent'] += $v['total_percent'] AND $group[$v['vat_code']]['discount_percent'] += $v['discount_percent'] ) : ($group[$v['vat_code']] = $v); } print_r(array_values($group));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [total_price] => 77.12 [total_percent] => 0.8 [vat_code] => 22 [discount_percent] => 15.42 ) [1] => Array ( [total_price] => 20.000000 [total_percent] => 0.21 [vat_code] => 4 [discount_percent] => 4.00 ) )

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:
148.92 ms | 406 KiB | 5 Q