91-9990449935 0120-4256464 |
PHP BreakPHP break statement breaks the execution of current for, while, do-while, switch and for-each loop. If you use break inside inner loop, it breaks the execution of inner loop only. Syntax Flowchart PHP Break: inside loopLet's see a simple example to break the execution of for loop if value of i is equal to 5. Output: 1 2 3 4 5 PHP Break: inside inner loopThe PHP break statement breaks the execution of inner loop only. Output: 1 1 1 2 1 3 2 1 2 2 3 1 3 2 3 3 PHP Break: inside switch statementThe PHP break statement breaks the flow of switch case also. Output: number is equal to 200
Next TopicPHP Functions
|