You are here: Re: [PHP] Foreach problem. « PHP « IT news, forums, messages
Re: [PHP] Foreach problem.

Posted by trlists on 02/11/05 05:18

On 10 Feb 2005 Richard Lynch wrote:

> Perhaps you need to use http://php.net/reset
>
> You see, when you do foreach or each or any of those, there is an
> "internal" setting in the array that is altered to keep track of where you
> are. Kind of like a big "You are here" arrow inside the guts of the
> array.

I believe this is incorrect. Or if not, the docs are wrong. From
http://www.php.net/manual/en/control-structures.foreach.php:

Note: When foreach first starts executing, the internal array
pointer is automatically reset to the first element of the array.
This means that you do not need to call reset() before a foreach
loop.

I don't know why the original poster had a problem, it seems mysterious
so far, but it seems it probably wasn't for lack of a reset() call.

--
Tom

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация