当在字符串中找到“最佳匹配”时,下面的脚本应该结束,但即使我知道最终找到它,脚本也会继续运行。请帮我解决我的错误。
$end = "1";
while ($end != 2) {
foreach($anchors as $a) {
$i = $i + 1;
$text = $a->nodeValue;
$href = $a->getAttribute('href');
//if ($i<80) {
//if (strpos($item, ".$array.") == false) {
//}
if (strpos($text, "best match") == true) {
$end = "2";
}
if (strpos($text, "by owner") === false) {
if (strpos($text, "map") === false) {
if ($i > 17) {
echo "<a href =' ".$href." '>".$text."</a><br/>";
}
}
}
}
//$str = file_get_contents($href);
//$result = (substr_count(strip_tags($str),"ipod"));
//echo ($result);
}