PHP Continue - Code

PHP Break Previous Next PHP Function


PHP Continue Statement is used to continue the loop, if a specified condition is true.

Here is the code of php continue statement.

Filename: php / continue.php


Code
<?php
for($i=1;$i<=6;$i++){
if($i==4){
    continue;
}
echo $i . "
"; } ?>

Running Step.


Type Url - https://localhost/php/continue.php

Output
1
2
3
5
6

Continue Without <br> Tag.


Continue Without <br> tag will give output in same line called as inline.

Filename: php / continue1.php


Code
<?php
for($i=1;$i<=6;$i++){
if($i==4){
    continue;
}
echo $i;
}
?>

Running Step.


Type Url - https://localhost/php/continue1.php

Output
12356

Continue With While Loop


Below code show you how to use continue in while loop

Filename: php / while-continue.php


Code
<?php
$i=1;
while($i<=7){
if($i==4){
    continue;
}
echo $i . "
"; $i++; } ?>

Running Step.


Type Url - https://localhost/php/while-continue.php

Output
1
2
3
5
6
7

Tags: PHP Continue PHP Code Programming Language


Was this helpful ?

Related Code