Re: [PHP] search array for value

2001-07-31 Thread Lenar
> > How do I search an array? > > > > For example if I want to know if $array contains "1"... > > > > Regards, > > > > Matthew Delmarter > > > This is bad, use in_array() or array_search(). in_array() returns TRUE if element is found in array. array_search returns the key of matching element, FALS

RE: [PHP] search array for value

2001-07-30 Thread Warren Vail
Mailing List Subject: [PHP] search array for value How do I search an array? For example if I want to know if $array contains "1"... Regards, Matthew Delmarter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

RE: [PHP] search array for value

2001-07-30 Thread Warren Vail
Subject: [PHP] search array for value How do I search an array? For example if I want to know if $array contains "1"... Regards, Matthew Delmarter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Re: [PHP] search array for value

2001-07-30 Thread DrWebPat
In a message dated 7/31/01 12:32:59 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: > How do I search an array? > > For example if I want to know if $array contains "1"... > > Regards, > > Matthew Delmarter > for ($i = 0; $i < count($array); $i++) { if ($array[$i] == 1) {

[PHP] search array for value

2001-07-30 Thread Matthew Delmarter
How do I search an array? For example if I want to know if $array contains "1"... Regards, Matthew Delmarter -- 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-ma