关键字break代码优化片段,
程序员文章站
2022-04-18 20:10:08
...
关键字break代码优化片段,
$data=array(); //循环页面 foreach($config_content['pages'] as $page_type_key=>$page_type_val){ if($page_type_val['page_type']==$page_type){ //循环模块 foreach($config_content['pages'][$page_type_key]['blocks'] as $block_type_key=>$block_type_val){ if($block_type_val['blocktype']==$blocktype){
foreach($_POST as $key=>$val){ if(is_string($val)){ $data[$key] = trim($val); }else{ $data[$key] = $val; } } $config_content['pages'][$page_type_key]['blocks'][$block_type_key]['settings']=$data;
break;//代码优化的地方,跳出内层的foreach循环 } } break;//代码优化的地方,跳出外层的foreach循环 } }