sum spezifische Werte in einem mehrdimensionalen Array (PHP)
Ich habe ein mehrdimensionales Array wie dieses:
Totalarray
(
[0] => Array
(
[city] => NewYork
[cash] => 1000
)
[1] => Array
(
[city] => Philadelphia
[cash] => 2300
)
[2] => Array
(
[city] => NewYork
[cash] => 2000
)
)
und ich möchte den Wert [cash] der Sub-Arrays summieren, die den gleichen Wert [city] haben, und ein Array wie das folgende erhalten:
Totalarray
(
[0] => Array
(
[city] => NewYork
[cash] => 3000
)
[1] => Array
(
[city] => Philadelphia
[cash] => 2300
)
)
Wie kann ich es tun