PHP Programs

Program for do-while loop

In this program demonstrate use of do-while loop.  do -While Loops are used to execute statement repeatedly depending on condition

 

do while loop is also  known as entry control  loop in which block of code execute at least once.

Program

<html>

<body>

<?php

$i=0;

$sum=0;

do

    {

      $i++;

    } while($i<10);

        echo("Loop Stopped At i=$i");

?>

</body>

</html>

When Run The Program Following Output:

Loop Stopped At i=10

Description

do While loop is another loop that has following syntax

 

Syntax of while

 

do{

 

// code to be executed

 

} while(condition);

Releted Programs

© 2017 codewmAll rights reserved.