I have provided you with an example that will define a loop that starts with i=1. The loop will continue to run as long as i is less than, or equal to 7. The variable i will increase by 1 each time the loop runs. Here is a coding for this example :
Code:
<html>
<body>
<?php
$i=1;
while($i<=7)
{
echo "The number is " . $i . "<br />";
$i++;
}
?>
</body>
</html>
The output of the above coding will be :
Code:
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
Bookmarks