I have an array like this:
$a = array(
array('amount'=>10,'curr'=>'USD'),
array('amount'=>20,'curr'=>'JPY'),
array('amount'=>30,'curr'=>'BAT'),
array('amount'=>50,'curr'=>'BAT'),
array('amount'=>100,'curr'=>'USD')
);
I want to sum all amount the same currency together and return like this:
$total = array('BAT'=>80,
'JPY'=>20,
'USD'=>110
)
1 Answer