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 while loop

    PHP while loop statement allows to repeatedly run the same block of code until a condition is met.

    Syntax:

    <?php 
    while (condition){ 
      //Code to be executed; 
    } 
    ?>

    php-while

    Example:

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

    Program Output:

    Hello while 1 times
    
    Hello while 2 times
    
    Hello while 3 times
    
    Hello while 4 times
    
    Hello while 5 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.