两者中哪个更优?I can't test it on my computer, I can't rely on it.
foreach($links as $link){
if($a){
//do something
}
if($b){
//do something
}
if($c){
//do something
}
if($d){
//do something
}
}
或:
if($a){
foreach($links as $link){
//do something
}
}
if($b){
foreach($links as $link){
//do something
}
}
if($c){
foreach($links as $link){
//do something
}
}
if($d){
foreach($links as $link){
//do something
}
}