日期:2014-05-17 浏览次数:20418 次
array ( 'time' => '2012-03-05 13', 'type' => 'ETC56-605N', 'count' => '52', ) array ( 'time' => '2012-03-05 14', 'type' => 'ETC56-605N', 'count' => '8', ) array ( 'time' => '2012-03-05 14', 'type' => 'ETC56-542N', 'count' => '39', ) array ( 'time' => '2012-03-05 15', 'type' => 'ETC56-542N', 'count' => '41', ) array ( 'time' => '2012-03-05 15', 'type' => 'ETC61-560N', 'count' => '10', )
$arr = array( array ( 'time' => '2012-03-05 13', 'type' => 'ETC56-605N', 'count' => '52', ), array ( 'time' => '2012-03-05 14', 'type' => 'ETC56-605N', 'count' => '8', ), array ( 'time' => '2012-03-05 14', 'type' => 'ETC56-542N', 'count' => '39', ), array ( 'time' => '2012-03-05 15', 'type' => 'ETC56-542N', 'count' => '41', ), array ( 'time' => '2012-03-05 15', 'type' => 'ETC61-560N', 'count' => '10', ) ); foreach($arr as $array) { $newarr[$array['time']][$array['type']] += $array['count']; } print_r($newarr);