Re: [PHP] key for in_array()

2009-06-08 Thread Daniel Brown
On Mon, Jun 8, 2009 at 17:33, Dee Ayy wrote: > array_search > in the See Also section for in_array docs? You and Andrew are quick today. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Co

Re: [PHP] key for in_array()

2009-06-08 Thread Dee Ayy
array_search in the See Also section for in_array docs? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] key for in_array()

2009-06-08 Thread Andrew Ballard
On Mon, Jun 8, 2009 at 5:29 PM, tedd wrote: > 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: > > f

[PHP] key for in_array()

2009-06-08 Thread tedd
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)