Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    PHP do-while

    PHP do while loop is very similar to the while loop, but it always executes the code block at least once and furthermore as long as the condition remains true.

    Syntax:

    <?php 
    do{ 
      code to be executed; 
    } 
      while (condition); 
    ?>

    php-do-while

    Example:

    <?php
    $i=0;
    do{
      $i++;
      echo "php do...while loop $i times"."<br>";
    }
      while ($i<=5);
    ?>

    Program Output:

    PHP do...while loop 1 times
    
    PHP do...while loop 2 times
    
    PHP do...while loop 3 times
    
    PHP do...while loop 4 times
    
    PHP do...while loop 5 times
    
    PHP do...while loop 6 times


    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.