PHP Basic Tutorial
The break
statement is particularly useful when you need to stop loop execution based on a condition, preventing unnecessary iterations.
break
in a for
LoopThe break
statement can be used to jump out of a for
loop.
Try it yourself
Note
You can also use break statement in while, do...while and foreach loop.