1<?php
2for($i=0;$i<10;$i++)
3{
4 if($i==3)
5 {
6 continue; //it will break one iteration.
7 }
8 echo $i;
9}
10?>
1$stack = array('first', 'second', 'third', 'fourth', 'fifth');
2
3foreach($stack as $v){
4 if($v == 'second') {
5 continue;
6 }
7 echo $v.'<br>';
8}
9/*
10first
11third
12fourth
13fifth
14*/
1$basket = ['apples', 'bananas', 'broccoli', 'peaches', 'pears'];
2
3foreach ($basket as $fruit) {
4 if ($fruit === 'broccoli') {
5 continue; // Skips 'broccoli' and moves onto 'peaches'
6 }
7
8 echo sprintf('I love %s!', $fruit);
9}
10
11// I love apples!
12// I love bananas!
13// I love peaches!
14// I love pears!