|
Posted by Magnus Warker on 07/24/05 16:40
Hi,
I want to traverse an (associative) array, starting from its current
position, until a certain element is reached. Then, in certain cases, I
want to be able to reset the current position of the array to the one that
we had before touching the array.
I. e., i need something like funcctions getpos and setpos:
----------
$pos = getpos ($list);
do
{
$item = current ($list);
$name = key ($list);
next ($list);
} while (!isWanted ($item));
setpos ($list,$pos);
----------
What I really need in the above example is:
Check, if we *could* get another wanted item from the list, but actually
leave the list (its current position) untouched.
Any ideas?
Many thanks,
Markus
Navigation:
[Reply to this message]
|