以下のスクリプトは、文字列に「最も一致する」文字列が見つかったときに終了するはずですが、最終的には見つかったとわかっていても、スクリプトは実行を続けます。エラーの修正を手伝ってください。
$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);
}