infolink

Thursday, 29 March 2012

The do...while Loop Example in PHP

In this Example I discus the do...while loop in php. In the do...while loop first execute the statement of loop and then check the condition. When the loop start first time the statements between the loop must execute and after that statements will execute if the condition will true, if the conditions will not true then the loop will be terminate.

This is the example code of PHP do while loop:


<?php
$i=1;
do
  {
  $i++;
  echo "The number is " . $i . "<br />";
  }
while ($i<=5);
?>

No comments:

Post a Comment