![]() |
|
|
#1
|
|||
|
|||
|
More flexibility in searching an array
I am trying to search an array to see if it contains a certain word but the in_array(); function (form what I can see) needs to be the exact value of the array values. Here is an example:
Code:
$fruit = array('Green Apple', 'Yellow Banana', 'Red Cherry');
|
|
#2
|
||||
|
||||
|
You could use foreach and loop through the array preforming a strpos on each element.
Try something like this untested copied and pasted junk... php Code:
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Full Time PHP Coder Position - Salary + Paid Holidays + Flexibility | LeeD | Programming | 0 | Jan 3rd 2008 1:15 pm |
| Add array in array recursively? | nljeffrey | PHP | 3 | Oct 26th 2007 7:02 am |
| searching a page for links and putting links into array - beginner | angrypenguin | PHP | 2 | Sep 1st 2007 10:12 am |
| Array in array [help ! urgent] | er1cw | PHP | 9 | Oct 9th 2006 10:03 am |
| Array problem: function.reset: Passed variable is not an array or object | beniwtv@hotmail.com | PHP | 1 | Mar 2nd 2006 6:20 pm |