do..while Loop in PHP


Prev Tutorial Next Tutorial

do..while Loop in PHP

do..while loop is used where you need to execute code at least once. The do...while loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.

Syntax

do
{  
//code to be executed  
}
while(condition);  

Example of do....while Loop in PHP

<?php

$x = 0; 

do
{
    echo "$x <br>";
    $x++;
} while ($x <= 10);

?>

Output

0 1 2 3 4 5 6 7 8 9 10

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements