I have a given array:
$array = array('one','two','three_num3','four');
and a dynamic variable:
$term = $_GET['term'];
I'm currently using array_search() to search $array:
$target = array_search($term,$array);
if ($target > -1) {
echo $target;
} else {
echo 'No Target Result';
}
$target yields no result if $term is just 'three' or 'num3'.
I want to be able to find 'three_num3' in the $array where $term is either 'three' or 'num3' and is a match for 'three_num3'.
In other words, I want the underscore to act as a sort of divider, but effectively remain as one string.
Any simple way to go about this?