The while loop executes a block of code while a condition is true.
Code:<html> <body> <?php $i=1; While($i<=5) { echo "The number is" . $i . "<br />"; $i++; } ?> </body> </html>
Out Put:
The number is1
The number is2
The number is3
The number is4
The number is5
Loop that starts with i=1. The loop will continue to run as long as i is less than, or equal to 5. i will increase by 1 each time the loop runs:
Bookmarks