DoA
03-20-2010, 12:00 AM
As you can see, the Target is 3.com and it IS in the array ... so why isn't this working??
It's continuously outputting Not Found
<?php
$Target="3.com";
$arr=array("http://1.com","http://2.com","http://www.3.com/whatever","http://4.com");
foreach($arr as $key => $value);
{
if(stristr($value, $Target))
{
$Position = $key;
}
else
{
$Position = "Not Found";
}
echo $Position;
}
?>
It's continuously outputting Not Found
<?php
$Target="3.com";
$arr=array("http://1.com","http://2.com","http://www.3.com/whatever","http://4.com");
foreach($arr as $key => $value);
{
if(stristr($value, $Target))
{
$Position = $key;
}
else
{
$Position = "Not Found";
}
echo $Position;
}
?>