## PHP for loop continue statement

Start PHP Code RESULT

4000 divided by -4 is... -1000

4000 divided by -3 is... -1333.3333333333

4000 divided by -2 is... -2000

4000 divided by -1 is... -4000

continue bypasses div by 0

4000 divided by 1 is... 4000

4000 divided by 2 is... 2000

4000 divided by 3 is... 1333.3333333333

4000 divided by 4 is... 1000

4000 divided by 5 is... 800

4000 divided by 6 is... 666.66666666667

4000 divided by 7 is... 571.42857142857

4000 divided by 8 is... 500

4000 divided by 9 is... 444.44444444444

4000 divided by 10 is... 400

End PHP Code RESULT

The PHP Code START
$counter = -4;
for (; $counter <= 10; $counter++) {
if ( $counter == 0 ) {
print "<span class=code>continue bypasses div by 0</span><br />";
continue;
}
$temp = 4000/$counter;
print "4000 divided by $counter is... $temp<br />";
}

The PHP Code END
Back to Bill's PHP