php foreach嵌套循环怎么优化
两个二维数组,用forearch嵌套循环判断,外层有两千多条,内层有两万多条数据,加起来有四百多万条数据,打开网页的2分钟,有没有大神知道?请指点一二。foreach($...
两个二维数组,用forearch嵌套循环判断,外层有两千多条,内层有两万多条数据,加起来有四百多万条数据,打开网页的2分钟,有没有大神知道?请指点一二。
foreach($nurse_id as $kk=>$vv){
$nurse_id[$kk]['count_record']=0;
foreach ($yui as $aa=>$bb){
if($vv['daily_service_id']==$bb['daily_service_id'] && $vv['nurse_id']==$bb['nurse_id']){
$nurse_id[$kk]['count_record']++;
$nurse_id[$kk]['performance']=$bb['performance'];
}
}
} 展开
foreach($nurse_id as $kk=>$vv){
$nurse_id[$kk]['count_record']=0;
foreach ($yui as $aa=>$bb){
if($vv['daily_service_id']==$bb['daily_service_id'] && $vv['nurse_id']==$bb['nurse_id']){
$nurse_id[$kk]['count_record']++;
$nurse_id[$kk]['performance']=$bb['performance'];
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询