05-11-2008, 11:55 PM
|
#3 (permalink)
|
|
The Gregarious
Join Date: Sep 2007
Posts: 549
Thanks: 15
|
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
__________________
There are two ways to write bug-free code, only the third one works.
|
|
|
|