> > What I'm getting is that the inner while loop executes on the first
> > execution of the outer while, and then not at all.  How would I get
> > it to execute each time?
>
> Coming from a perl background, I got stuck there too when I started using
> PHP.  PHP has this odd notion of an array pointer.  After the first time you
> loop through the array, the pointer is at the end, so the second loop won't
> really do anything.  Use the reset frunction to reset the array pointer to
> the first element.

The array pointer can be pretty useful.  ie. give me the second last
element of an array:

  end($arr);
  echo prev($arr);

Or have it tell you what the index is at the second last element:

  end($arr);
  prev($arr);
  echo key($arr);

and the index before that one:

  prev($arr);
  echo key($arr);

Perl has these too, they just aren't user accessible.

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to