key for in_array()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi gang:

Does anyone have a slick way to determine what the key would be for a successful find in in_array()?

Such as:

if (in_array($var, $array))
   {
   // what's they key for *this* successful find?
   }

I know I could use:

foreach($array as $key => $value)
   {
   if ($value == $var)
     {
      // then I know what the key would be.
     }
   }

But is there a simpler way using in_array()?

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux