breakPHP和PHP有什么区别continue?
break
continue
break完全结束一个循环,continue只是缩短当前迭代并继续下一个迭代。
while ($foo) { <--------------------┐ continue; --- goes back here --┘ break; ----- jumps here ----┐ } | <--------------------┘
这将像这样使用:
while ($droid = searchDroids()) { if ($droid != $theDroidYoureLookingFor) { continue; // ..the search with the next droid } $foundDroidYoureLookingFor = true; break; // ..off the search }