Monday, December 31, 2012

While Loop in PHP

<?php
    $var = 'I love PHP'; //initialize the string variable var
    $i=0; // initialize i = 0
    while($i<5){
        echo $var.'<br>'; //printing 5 times the string var
        $i++; //incrementing the value of i
    }
?>

No comments:

Post a Comment