19) Break in PHP| why used break keyword

Опубликовано: 04 Ноябрь 2024
на канале: programming_with_vinay
1

PHP break statement breaks the execution of the current for, while, do-while, switch, and for-each loop. It breaks the current flow of the program at the specified condition and program control resumes at the next statements outside the loop.


When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.
It can be used to terminate a case in the switch statement (covered in the next chapter).