You are here: Re: how to save/restore current array position? « PHP Programming Language « IT news, forums, messages
Re: how to save/restore current array position?

Posted by Magnus Warker on 07/24/05 18:46

Dear Shelly,

thank you again for giving hints! .-)

> OK, that is simpler. Here is a suggestion. Set a hidden variable as
> "the_index" with a value equal to zero. Then as your index changes, set
> the
> value of the_index to that value. Now you begin the loop at the value of
> the_index with a pre-test.
>
> $pos = $POST['the_index'] or $pos = $the_index. (I'm not sure which)
> while (blah) do {
> }

I think there is a misunderstanding here:

I have an associative array, and my understanding of this kind of creature
is that we cannot access elements by a numerical index, right?

So storing a value in $POST['the_index'] means storing the key of the
current item.

In analogy, retrieving a value from $POST['the_index'] means retrieving the
key of the item which was the current item some time ago.

However, having the key of the item which was the current item some time ago
does not enable me to set the internal pointer of the "current" item within
the array, does it?

My problem is not storing and retrieving some values, but modifying the
internal state of an array.

See what I mean?

Magnus

 

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

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