Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found

From: Date: Tue, 20 Feb 2001 16:43:48 +0000
Subject: Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.dev 
Request: Send a blank email to php-dev+get-47069@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > > On Tue, 20 Feb 2001, Stig Venaas wrote: > > I could in order to save the position do $key = key($arr). To > > restore it later, I could then do something like array_setpos($key). > > I'm not sure if the Zend API allows for setting the position without > > looping through the array though. If array_setpos() is passed a non- > > existing key it should return FALSE, else TRUE. > > I don't think Zend API allows that, but it's possible if you loop > through it. > > > > > What do you think? > > I wouldn't have a use for that function personally, but I can't say the > same for others... I could think of a use for this if you were consistently traversing through a very large array, and you wanted to push and pop starting positions. -Jason

« previous php.dev (#47069) next »