On Tue, 20 Feb 2001, Stig Venaas wrote:
> Not quite sure we need array_find(). If we can have in_array() set
> the array pointer to point to the entry found, one can get the key
> by using key(). If in_array() also searches from the pointer onwards,
> one can find all entries with the value by doing:
>
> reset($arr);
> while (in_array($val, $arr)) {
> $keys[] = key($arr);
> next($arr);
> }
in_array() used to move the pointer to the entry found, but people
complained about it so I remove it... :)
> I would prefer this rather then adding array_find() I think. If we
> add array_find() I want similar functionality there. If not, I would
> like an option for returning an array with all entries with the value.
You can use array_keys($array, 'value') for that.
-Andrei
"The galaxy is, in other words, an immensely, intrinsically,
and inexhaustibly interesting place." -- Iain M. Banks
--
PHP Development 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]