PHP Break Statement
The break statement in PHP is used to terminate the execution of a loop or switch statement.
Syntax
break;
Example of PHP Break Statement
<?php
for ($i = 0; $i < 10; $i++) {
if ($i == 5) {
break;
}
echo $i . "\n";
}
?>
Output:
0
1
2
3
4
Explanation: This example demonstrates the use of the break statement in PHP. The loop is terminated when the value of $i is 5.