<?php
$a[0]["streamtitle"]= "SEM-VI";
$a[1]["streamtitle"]= "CE";
$a[2]["streamtitle"]= "B.E.";
$b[0]["streamtitle"] = "SEM-VI,CE,B.E.";
$b[1]["streamtitle"] = "SEM-VII,CE,B.E.";
$b[2]["streamtitle"] = "SEM-VIII,CE,B.E.";
$b[3]["streamtitle"] = "SEM-VI,EC,B.E.";
$b[4]["streamtitle"] = "SEM-VI,CE,B.E.";
$i=0;
for($i=0; $i<sizeof($b); $i++) {
if (strstr($b[$i]["streamtitle"], $a[0]["streamtitle"]) && strstr($b[$i]["streamtitle"], $a[1]["streamtitle"]) && strstr($b[$i]["streamtitle"], $a[2]["streamtitle"]))
print "found ".'</br>';
else
print "not found".'</br>';
}
?>
Hi all,
I am filtering the value from array $b which has value same as $a.
The above code is working fine some time but fails when i give SEM-V.
When i takes
$a[0]["streamtitle"]= "SEM-V";
$a[1]["streamtitle"]= "CE";
$a[2]["streamtitle"]= "B.E.";
it matches four elements from $b as each string contains ‘SEM-V’ as substring and CE, B.E. is also common, doesn’t matter it is SEM-V,SEM-VI, SEM-VIII etc….
Please suggest me some idea to match ‘SEM-V’ only….
If the format of the streamtitle always uses commas as the delimiter, you can match “SEM-V,” instead of “SEM-V”.
Other options include exploding the streamtitle and checking the different parts.