while/foreach/for loop Skip to Next Iteration

If you need to skip to the next item inside of a PHP loop its simple with the continue; control keyword. You can also use continue with nested loops. For example, a continue 2; would break out of 2 nested loops.

foreach($items as $item){
	if($item==0){
		//skip to next iteration if item value is 0
		continue;
	}
}

Leave a Reply

Your email address will not be published.