答案 0 :(得分:0)
根据您的问题,我假设您要查找特定日期每个房间的总数qty
。
$totals = array();
foreach($arr as $val){
if (array_key_exists($val['room'], $totals) && array_key_exists($val['check_in_date'], $totals[$val['room']]))
{
$totals[$val['room']][$val['check_in_date']] += $val['qty'];
} else {
$totals[$val['room']][$val['check_in_date']] = $val['qty'];
}
};
echo "<pre>";print_r($totals);