哪個會更適合這兩個? I can't test it on my computer, I can't rely on it.
多個foreach vs多個if內部foreach
foreach($links as $link){
if($a){
//do something
}
if($b){
//do something
}
if($c){
//do something
}
if($d){
//do something
}
}
OR:
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
}
}
怎麼來的,這是社會維基? – Michelle
@JackSpairow因爲我的鼠標。大聲笑 – Leri