In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Christian Dechery) wrote:

> $myArray = array(
>                       "one" => "something",
>                       "two" => "otherthing",
>                       "three" => "whatever"
>               );
> 
> I want to, given the key (or value), it returns me the numeric index for 
> that ocurrence... examples:
> 
> given "one" -> returns 0
> given "whatever" -> returns 2
> given "two" -> returns 1
> given "four" -> returns NULL or false...

http://php.net/manual/en/function.array-search.php

(It's only avaliable in PHP4 CVS so far, but see the annotations for 
examples of user functions to do the same thing.)

-- 
CC

-- 
PHP General 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]

Reply via email to