The simplest loop is the while loop. Simple format and repeats while the condition is true.

[source:php]$num = 0;
while ($num < 10) {
print $num;
$num++;
}
[/source]

This of course would print the numbers from 0 to 9 in one long line ie. 0123456789

Trackback URL for this post: http://www.stuffbysarah.net/2006/01/28/the-php-while-loop/trackback/

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Latest Tweets