PHP Programming

Hands On No. 12 : Working with break and continue PHP

Working with break and continue PHP

Using break

                              

<?php
for ($x = 0; $x < 10; $x++)
{
if ($x == 4)
{
break;
}

echo "The number is: $x <br>";

}

?>

Using continue
                              

<?php
for ($x = 0; $x < 10; $x++)
{
if ($x == 4)
{
continue;
}

echo "The number is: $x <br>";

}

?>