配列ごとに配列を計算することは可能ですか?
たとえば、各の[num]
との合計を計算します。[price]
[group]
Array
(
[0] => Array
(
[group] => Apple
[num] => 5
[price] => 10
)
[1] => Array
(
[group] => Apple
[num] => 2
[price] => 8
)
[2] => Array
(
[group] => Orange
[num] => 4
[price] => 6
)
[3] => Array
(
[group] => Orange
[num] => 12
[price] => 24
)
)
結果は次のようになります。
Array
(
[0] => Array
(
[group] => Apple
[num] => 7
[price] => 18
)
[1] => Array
(
[group] => Orange
[num] => 16
[price] => 30
)
)