-3
如果产品ID相同,如何求和数组值?我需要总和product_price,quantity,total_price,shipping_price。这是我的例子如果product_id相同,如何求和数组值?
[936] => Array
(
[order_number] => 936
[status] => cancelled
[products] => Array
(
[0] => Array
(
[product_id] => 19
[sku] => sku2222222
[product_price] => 12.00
[quantity] => 1
[total_price] => 17
[shipping_price] => 5.00
)
[1] => Array
(
[product_id] => 19
[sku] => sku2222222
[product_price] => 12.00
[quantity] => 1
[total_price] => 17
[shipping_price] => 5.00
)
[2] => Array
(
[product_id] => 5
[sku] => sku2222222
[product_price] => 12.00
[quantity] => 1
[total_price] => 17
[shipping_price] => 5.00
)
)
)
我需要的结果是这样的:
http://paste.ofcode.org/zeRZfLwDKj7btTtn2KSnmZ
请分享所需的结果格式 –
'for'循环将有所帮助。 –
你可以使用PHP LINQ做选择更新删除操作请看https://phplinq.codeplex.com/wikipage?title=示例url for more info –