Monday, June 16, 2008

loop inside loop - user request

long time no post...
kalabaw20 asked me on a video tutorial i did on youtube (link here)... to do multiple loops .. so here's a loop inside a loop:
you add for example a while inside another one using different variables for incremention.. like this:
{
$i=0
while($i<100){
$y=0;
while($y<100){
echo $i."-".$y."
";
$y++;
}
$i++;
}
?>
The above code will show something like:
0-0
0-1
0-2
0-3
.
.
0-99
0-100
1-0
1-1
1-2
.
.
and so on.. untill it reaches 100-100