I have two for loop inside another, I want to break loop if
$i=1 and $ii < 180
condition
I declared that in a if statement but it doesnt work, it prints smaller than 180 $ii values.
for ($i=1;$i<6;$i+=2) {
for($ii=1;$ii<1733;$ii+=3) {
if( $i == 1 && $ii < 180 ){ break; }
echo '--'.$i.'-'.$ii.'--</br>';
}
}
how can fix this
for ($i=1;$i<6;$i+=2) {
for($ii=1;$ii<1733;$ii+=3) {
if( $i == 1 && $ii < 180 ){ continue; }
echo '--'.$i.'-'.$ii.'--</br>';
}
}
You need to use:
break 2;
as you are breaking 2 loops.
More information: http://php.net/manual/en/control-structures.break.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.