for($check = 0; $check<12;$check++)
{
echo "<strong>" .$cars[$check] .":</strong>";
foreach($models as $model)
{
if ( stristr($model, $cars[$check]))
{
echo $model;
}
}
}
$cars is an array that contains 12 vehicle makes, $models is a large array (about 3000 elements) which contains many models of different car makes. I expect from my code to echo the model name if it can find the name of the car ($cars[$check]) in it. The problem is that it returns nothing, but if I replace the "$cars[$check]" in the if function with a static string like "BMW", then it has no problem in returning the models that contain the string "BMW". I tried everything for hours and searched the internet in and out and couldn't find a solution. Is it something wrong with the code, or have approached this in a wrong way?