In PHP while loop executes through a block of code until the condition is evaluate to true.
Syntax :
while (condition)
{
code to be executed;
}
{
code to be executed;
}
Example :
<?php
$int = 1;
while( $int <=5)
{
echo $int."<br>";
$int++;
}
?>
$int = 1;
while( $int <=5)
{
echo $int."<br>";
$int++;
}
?>
Output :
1
2
3
4
5
0 Comments