Press "Enter" to skip to content

phpbreak

PHP Break

PHP break ends running of the current for ,foreach, while,do while or switch structure.

Example for PHP Break

<?php
for ($i=1;$i<=10;$i++)
{
if($i==5)
break;
echo $i; //will print till 4 number after that the loop will break and stop execution
}
?>