Re: array search
| From: | Papp Gyozo | Date: | Fri, 31 Aug 2001 16:02:20 +0000 |
| Subject: | Re: array search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65510@lists.php.net to get a copy of this message | ||
yes, in_array($person, $people)!
however, you may take a look into the manual.
----- Original Message -----
From: Joseph Bannon <JBannon@advparadigm.com>
To: PHP (E-mail) <php-general@lists.php.net>
Sent: Friday, August 31, 2001 5:40 PM
Subject: [PHP] array search
> I have an array of names, like below...
>
> $people = array("Jim","John","JP");
>
> Is there a way in an IF statement to see if someone's name is in the
array?
> Like...
>
> if ($people =~ $person) { }
>
> I don't want to have to create a foreach loop to go through the array to
see
> if that person is there.
>
> Joseph
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>