CODE CODIFY.CLUB

Difference between break and continue in PHP?

What is the difference between break and continue in PHP?

1) break ends a loop completely.
2) continue just shortcuts the current iteration and moves on to the next iteration.

while ($condition_true) {   <--------------------┐
continue; --- goes back here --┘
break; ----- jumps here ----┐
} |
<-
----------------------------------------┘

 

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed