| |
|
PHP while loop statement script and example |
While loop in PHP is very simple and similar to while loop in C programming.
In PHP while loop the condition is checked at the beginning of the loop and the
statement inside is executed till the end of the loop, then again the condition
is checked and loop executed. Like this loop is continued till the condition
became false and the loop is then stopped. Here if the condition became
false inside the loop then also the loop continue to execute till the next time
the condition is checked. Here is one simple example of while loop.
<? $j=5; // we assigned a value to the variable here
while($j <10 ){ // loop starts if condition is true
echo " value of $j= $j <br>"; $j=$j+1; }
?>
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|
|
|