do...while loop is executed at least once : do while « Statement « PHP






do...while loop is executed at least once

 
<?php
            $i = 11;
            do {
                    print "Number $i\n";
            } while ($i < 10);
    ?>


Same code could be written using a while loop:

    <?php
            $i = 11;
            while ($i < 10) {
                    print "Number $i\n";
            }
    ?>
  
  








Related examples in the same category

1.Counting to 10 with do ... while
2.Do-While Loop
3.do while loop with counter
4.do while with integer counter
5.Break in Nested Loops
6.Do while loop
7.The do...while Statement