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;
Chris W. Parker
on Tuesday, September 16, 2003 4:07 PM said:
This Is Good(tm):
for($x=0;$x100;$x++)
{
for($x=0;$x100;$x++)
{
echo Me happy now!!;
}
}
Hehe... whoops! Should be:
for($x=0;$x100;$x++)
{
for($y=0;$y100;$y++)
{
When I use for loops, at the start of each iteration, the variables hold the
values from the last loop.
First, is there an elegant way of clearing variables at the start of each
loop rather than using unset???! It just seems wrong.
Also, all my problems would be solved if variables in a for loop
* Thus wrote John Ryan ([EMAIL PROTECTED]):
When I use for loops, at the start of each iteration, the variables hold the
values from the last loop.
First, is there an elegant way of clearing variables at the start of each
loop rather than using unset???! It just seems wrong.
I'm unclear as
4 matches
Mail list logo