好吧,我必须说,我迷失了一种操作应该足够快的感觉,所以正在寻找性能快速的联合收割机。
我的数组看起来像
Array
(
[0] => Array
(
[id] => 35
[item] => Ball Pen
[qty] => 1
[price] => 23
[total] => 23
)
[1] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 1
[price] => 23
[total] => 23
)
[2] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 3
[price] => 23
[total] => 69
)
)
作为输出,如果 id 出现不止一次,我想要一个 qty 的总和
Array
(
[35] => Array
(
[id] => 35
[item] => Ball Pen
[qty] => 1
[price] => 23
[total] => 23
)
[34] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 4
[price] => 46
[total] => 92
)
)