key for in_array()
| From: | tedd | Date: | Mon, 08 Jun 2009 21:29:08 +0000 |
| Subject: | key for in_array() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-293771@lists.php.net to get a copy of this message | ||
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