I have 3 arrays, in this way:
$add[] = carblue,carred,bus;
$allad[] = car,carblue,carred,bus;
$fis[] = bus,car;
now i write this code:
foreach($add as $ad) {
foreach($fis as $fisvalue) {
if (in_array(substr($fisvalue, 0, strlen($ad)), $allad)) {
echo $fisvalue;
}
}
}
But result of this code is:
bus
car
bus
car
bus
car
car
I want just echo "bus car"
and the otherhand seems using two foreach necessary!
Can you have idea to solve my problem and echo just?:
car
bus
in other word, if value of $allad[]
starting with $fis[]
value echo $fis[]
value but just once, with out repeating!