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.
Searching for multiple values in an array
Moderator: General Moderators
-
tyler.pomroy
- Forum Newbie
- Posts: 8
- Joined: Mon Sep 29, 2008 1:49 pm
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Searching for multiple values in an array
Do in_array 3 times
.
Store it in a database?
There must be a more efficient way! Than the above 2 suggestions I made.
Google?
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
There are 10 types of people in this world, those who understand binary and those who don't
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Searching for multiple values in an array
I knew you would have a solution 