Page 1 of 1

Searching for multiple values in an array

Posted: Mon Dec 29, 2008 2:06 pm
by tyler.pomroy
I can't figure out how to do this.

I have an array for example:

$colors = array("red", "green", "blue", "orange", "purple", "yellow");

I have used in_array in the past to do this for a single value but what if I am wanting to check is if red, orange, AND yellow all show up in the array somewhere? How would I do that?

Thanks.

Re: Searching for multiple values in an array

Posted: Tue Dec 30, 2008 5:14 am
by jaoudestudios
Do in_array 3 times :D .

Store it in a database?

There must be a more efficient way! Than the above 2 suggestions I made.

Google?

Re: Searching for multiple values in an array

Posted: Tue Dec 30, 2008 5:16 am
by VladSun

Re: Searching for multiple values in an array

Posted: Tue Dec 30, 2008 5:31 am
by jaoudestudios
I knew you would have a solution :)