Re: Searching for array keys
| From: | mailing_list at gmx dot at | Date: | Fri, 04 May 2001 06:00:36 +0000 |
| Subject: | Re: Searching for array keys | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51370@lists.php.net to get a copy of this message | ||
> What's the best way of finding out if a specific array key is in an array?
> I have an associative array which *may* look like
> (car =>saab, house => mansion, countyW=> A) but can equally well look like
>
> (boat => daycruiser, house => flat, county => B).
>
> I want to find out if the key "car" is in the array and do something if it
try something like
if
(in_array("keyb",array_keys(array("key"=>"a","keyb"=>"b")))))
{
...
}
michael
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net