这是我的数组:
Array (
[0] => Array ( [date] => 28-10-2012 [total] => 100 [earn] => 10 )
[1] => Array ( [date] => 28-12-2012 [total] => 100 [earn] => 10 )
[2] => Array ( [date] => 28-12-2012 [total] => 90 [earn] => 9 )
[3] => Array ( [date] => 28-12-2012 [total] => 315.35 [earn] => 31.535 )
[4] => Array ( [date] => 02-01-2013 [total] => 1500 [earn] => 150 )
[5] => Array ( [date] => 02-01-2013 [total] => 1000 [earn] => 100 )
)
愿望输出:
Array (
[0] => Array ( [date] => 28-10-2012 [total] => 100 [earn] => 10 )
[1] => Array ( [date] => 28-12-2012 [total] => 505.35 [earn] => 505.535 )
[2] => Array ( [date] => 02-01-2013 [total] => 2500 [earn] => 250 )
)
到目前为止,我尝试的方法设法按日期分组,并且只用两个不同的数组总结一个字段。
Array ( [28-10-2012] => 100 [28-12-2012] => 505.535 [02-01-2013] => 2500)
Array ( [28-10-2012] => 10 [28-12-2012] => 50.535 [02-01-2013] => 250 )
这与我正在寻找的非常不同,仍然让我头疼。有什么可能的方法??