On Saturday, Aug 30, 2003, at 10:21 America/New_York, Derick Rethans wrote:
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.
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.
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php