iT邦幫忙

0

陣列如何讓相同日期的資料做加總? (已解決)

php
Array ( [0] => Array ( [日期] => 2018-10-16 [編號] => 0004 [價錢] => 150 [數量] => 1 [成本] => 70 [店家編號] => A001 )
        [1] => Array ( [日期] => 2018-10-16 [編號] => 0005 [價錢] => 130 [數量] => 1 [成本] => 50 [店家編號] => A001 )
        [2] => Array ( [日期] => 2018-10-16 [編號] => 0006 [價錢] => 150 [數量] => 2 [成本] => 120 [店家編號] => A001 ) 
        [3] => Array ( [日期] => 2018-10-20 [編號] => 0001 [價錢] => 130 [數量] => 1 [成本] => 65 [店家編號] => A001 ) 
        [4] => Array ( [日期] => 2018-10-31 [編號] => 0003 [價錢] => 150 [數量] => 2 [成本] => 140 [店家編號] => A001 ) )

如何讓陣列裡相同[日期]的資料[價錢]、[成本]做加總
最後輸出所有日期(不重複)的資料

尚未有邦友回答

立即登入回答