John Ryan <mailto:[EMAIL PROTECTED]>
on Saturday, September 13, 2003 9:26 AM said:
> When I use for loops, at the start of each iteration, the variables
> hold the values from the last loop.
You're doing it wrong then (I think).
1. You should always initialize your loop counters.
i.e.
$x = 0;
while($x < 100)
{
$x++;
}
2. Don't use the same counter name in all your loops.
This is bad:
for($x=0;$x<100;$x++)
{
for($x=0;$x<100;$x++)
{
echo "i'm going to go on forever!!";
}
}
This Is Good(tm):
for($x=0;$x<100;$x++)
{
for($x=0;$x<100;$x++)
{
echo "Me happy now!!";
}
}
Does that help?
Chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php