Learn web design and programming with our free video and text tutorials.
Web Designer? Design and market your own professional website with easy-to-use tools.
Browse our HTML, XHTML and CSS tutorials to learn how to create your website at LearnWebsiteDesign.com or download one of our free website templates.
Providing high quality free software to download
PHP while loops will execute a block of code if and as long as a specified condition is true.
<?php
$number = 0;
while ($number < 10) {
echo "This statement was executed $number times.<br />";
$number++;
};
?>
The code above outputs:
This statement was executed 0 times.
This statement was executed 1 times.
This statement was executed 2 times.
This statement was executed 3 times.
This statement was executed 4 times.
This statement was executed 5 times.
This statement was executed 6 times.
This statement was executed 7 times.
This statement was executed 8 times.
This statement was executed 9 times.