This is a mock example of my problem.
The 'for loops' will be contained inside a while loop, if that matters.
The code below should compare every element of each array and echo out the element that is the same. In this case 'Fat'.
However, the code is not working and I can't figure out why. I'm sure it's a simple fix, but I can't seem to find it.
$searchValue="Bob Is Fat";
$explode = explode(' ', $searchValue); //turns $searchValue into an array
$tags_cnt = count($explode); //counts elements in the array
$result_tag = array("Volvo", "Skinny", "Fat"); //creates an array
$row_cnt = count($result_tag); //counts elements in array
for($i=0; $i<$tags_cnt-1; $i++) {
for($x=0; $x<$row_cnt-1; $x++) {
if ($result_tag[$x] == $explode[$i]) {
echo $explode[$i];
}
} //2 forloop
} //1 forloop