On Sat, 30 Aug 2003 [EMAIL PROTECTED] wrote:

> 
> On Saturday, Aug 30, 2003, at 10:33 America/New_York, Derick Rethans  
> wrote:
> 
> > On Sat, 30 Aug 2003 [EMAIL PROTECTED] wrote:
> >
> >> Since the inner loop declares $i again, it should mask the outer  
> >> loop's
> >> $i as per other languages. Besides being useful, it makes more sense.
> >
> > No, that's not true. You don't redeclare ANYTHING here... you're just
> > using the same variable $i, just like you would do in C.
> 
> //In the following example, the inner loop 'i' masks the outer loop 'i':
> 
> int array[] = {1, 2, 3, 4, 5};
> 
> for (int i = 0; i < 5; i++)
> {
>          int num = array[i];
>          printf("%d", num);
>          for (int i = 0; i < 5; i++)
>                  printf("%d", i * num);
> }

*SIGH*

THIS EXAMPLE IS NOT THE SAME AS THE ONE IN PHP. IN PHP YOU DON'T DECLARE 
VARIABLES, THIS IS DONE AUTOMATICALLY FOR YOU THE FIRST TIME YOU USE IT. 
THEREFORE THE $i IN THE SECOND LOOP IS THE SAME VARIABLE AS IN THE FIRST 
LOOP. AGAIN, TAKES THIS CRAP OF THIS LIST AS IT IS NOT, I REPEAT *NOT* 
AN INTERNALS PROBLEM.

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/
-------------------------------------------------------------------------

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to