Hello friend,
Your problem can be easily remedied with preg_grep(). It is the equivelent to Perl's grep() function and the Unix Grep application. What it does is search every element in an array for a specified string and returns every matched array element.
Here us the syntax for the preg_grep() function:
array preg_grep(pattern, array);
and here is an example it in use:
$matched = preg_grep("/php/i", $array);
What this does, is run through every element in $array and search for "php". If this looks a little strange to you, it's because it's a Perl regular expression. The "i" modifier means case insensitive.
<?php
$array = array("Burger King", "Dairy Queen", "Taco Bell", "Jack in the Box");
foreach(preg_grep("/taco/i", $array) as $found){
print $found;
}
?>