Difference between break and continue in PHP?

Posted by Prem Tiwari | Updated on

Break is used with loops as well as switch case. Continue is only used in loops, it is not used in switch case. Break ends a loop completely, continue just shortcuts the current iteration and moves on to the next iteration.

This would be used like so:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers