3
我有陣列具有低於值如何基於兩個鍵求和(小計)數組?
Array
(
[0] => Array
(
[order_date] => 2016-01-01
[sku] => RK101
[qty] => 2
)
[1] => Array
(
[order_date] => 2016-01-01
[sku] => RK101
[qty] => 5
)
[2] => Array
(
[order_date] => 2016-01-01
[sku] => RK102
[qty] => 4
)
[3] => Array
(
[order_date] => 2016-01-02
[sku] => RK101
[qty] => 2
)
[4] => Array
(
[order_date] => 2016-01-02
[sku] => RK101
[qty] => 2
)
)
,我想求和陣列,首先由日期,然後按SKU,我想導致像下面
Array
(
[2016-01-01] => Array
(
[RK101] => Array
(
[qty] => 7
)
[RK102] => Array
(
[qty] => 4
)
)
[2016-01-01] => Array
(
[RK101] => Array
(
[qty] => 4
)
)
)
我有探索堆棧溢出,並發現許多帖子計算基於一個關鍵的總和,在這種情況下,我想總結基於日期的數組值,然後通過sku。 請用相同
謝謝bhai @chetan,它的工作 – Manoj