php代码优化问题 双层foreach如何优化

foreach ($rows as $key1 => $row) {
foreach ($country as $key2 => $val) {
if ($row['country'] == $val['id']) {
$rows[$key1]['country_as'] = $country[$key2]['country_ch'];
}
}
}

foreach ($rows as $key1 => $row) {
foreach ($country as $key2 => $val) {
if ($row['country'] == $val['id']) {
$rows[$key1]['country_as'] = $country[$key2]['country_ch'];
}
}
}


1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问