-1
我是圍繞做發揮從PHP5.3遷移生產代碼PHP7.1,我得到以下錯誤爲什麼在PHP7.1中2級別的中斷已被刪除,其替代解決方案可能是什麼?
PHP Fatal error: Cannot 'break' 2 levels
可能是什麼下面的代碼片段
$aud_found = false;
$audience = null;
foreach ($rules[0]['filterd_data_region'] as $k => $aud) {
if ($aud_found)
break;
$country = array();
//country
if ($aud['area_type'] == 'country') {
foreach ($aud['selected_tag_data']['selected_content_tags'] as $arr){
if ($aud_found)
break 2;
if ($ucountry == $arr['id']) {
$audience = $rules[0]['filterd_data_region'][$k];
$audience_id = $k;
$aud_found = 'country';
}
}
}
//region
if ($aud['area_type'] == 'region') {
foreach ($aud['selected_tag_data']['selected_content_tags'] as $arr){
if ($aud_found)
break 2;
if ($uregion == $arr['id']) {
$audience = $rules[0]['filterd_data_region'][$k];
$audience_id = $k;
$aud_found = 'region';
}
}
}
}
我的回答對你有幫助嗎? – vanloc
至少它運行但需要重新編寫邏輯。 –