from http://php.net/quickref.php

$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)){
    print "Got Irix";
    }
      
Andrey HristovIcyGEN Corporationhttp://www.icygen.comBALANCED SOLUTIONS
----- Original Message ----- 
From: "Joseph Bannon" <[EMAIL PROTECTED]>
To: "PHP (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 6: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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to