How to use special loop keyword :- continue and break
There are two special keyword available for looping
1. Continue
2. Break
Continue :- Continue keyword is used to continue the block of code while condition is false following example explain the concept of continue and break keyword.
<?php
for ($i = 1; $i < 10; $i++)
{
if ($i == 5)
{
echo("Loop continued at $i<BR>");
continue;
}
if ($i == 8)
{
echo("Loop terminated at $i<BR>");
break;
}
echo("Number $i<BR>");
}
?>
Break:- Break keyword is used for unconditional jump, above example explain the concept of break keyword.
If you want to learn more about php visit php tutorial and download php basic tutorial
No comments:
Post a Comment