PHP do while Loop for Beginner
The do...while loop - Loops through a block of code once, and then repeats the loop as long as the specified condition is true.
// using do ... while loop
// Increment Number Using do..while
$num = 1;
do {
echo "Number is :" . $num . "<br>";
$num++;
} while ($num <= 10);
echo "<br>";
// Decreament Number using do....while
$num = 10;
do {
echo "This is Number :" . $num . "<br>";
$num--;
} while ($num >= 0);

0 comments
Post a Comment