05-11-2008, 11:55 PM
|
#3 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
A nested loop is a loop inside a loop. For instance, if you are reading posts on a forum sequentially, you would read:
Topic 1 Post 1
Post 2
Post 3
Topic 2 Post 1
Post 2
Post 3
So on the so forth.
If you want a purely programmatic example, run this code.
PHP Code:
<?php for($i=0;$i<10;$i++) { echo "Main Level $i - "; for($j=0;$j<10;$j++) { echo "Sub-Level $j - "; } echo "<br />"; } ?>
Here is what it will output:
http://justanotherportfolio.com/nest.php
|
|
|
|