Hi,
I’m looking for array elements which contain a substring. Can someone help me understand why strpos will not find anything but an exact match? Thanks. Below is some sample code.
$data = array("ad1", "d2", "-d3");
$filters= array("d1");
$result=$filters[0]." Not Found";
foreach($data as $d){
echo $d,", ";
foreach($filters as $f){
if(stripos($f,$d)!==false)
{
$result="found ".$f;
}
}
}
echo $result;
this exact code echoed out: ‘ad1, d2, -d3, d1 Not Found’