unread
Variable scope is mediocre at best. For instances:
$array = array(1, 2, 3, 4, 5);
for ($i = 0; $i < 5; $i++)
{
$num = $array[$i];
echo $num;
for ($i = 0; $i < 5; $i++)
{
echo $num * $i;
}
}
The inner loop $i doesn't mask the outer loop $i.
Thus, the whole things gets screwed up.
unread
The inner loop $i doesn't mask the outer loop $i.
Thus, the whole things gets screwed up.
? This example works perfectly fine. What's your problem here? What do
you mean with "mask the outer loop"? Of course if you modify $i INSIDE
the loop the outer one is affected.
Derick
--
"Interpreting what the GPL actually means is a job best left to those
that read the future by examining animal entrails."
Derick Rethans http://derickrethans.nl/
International PHP Magazine http://php-mag.net/