...

View Full Version : While loops



Tri Edge
11-19-2007, 11:08 PM
I have to put a while loop in an assignment and I was wondering if someone could explain what it does and possibly give me an example then I can at least attempt it on my own, but an explination will be just fine thanks!

aedrin
11-19-2007, 11:35 PM
http://www.google.com/search?q=php+while+loop

Majoracle
11-19-2007, 11:57 PM
http://us3.php.net/manual/en/control-structures.while.php

Just a very basic example:


$i = 1;
while ($i <= 10) {
echo "This is line $i<br>"; // print line number
$i++; // add 1 to $i
}

Prints:

This is line 1
This is line 2
This is line 3
This is line 4
This is line 5
This is line 6
This is line 7
This is line 8
This is line 9
This is line 10



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum