テキストファイルを読み取り、単語を検索し、単語が見つかったかどうかに応じて異なる結果を表示するプログラムに取り組んでいます。
大文字を無視する方法はありますか? たとえば、応答という単語を探している場合、応答、応答、応答、応答、応答などを取得します。
コードは次のとおりです。
<?php
//1 email;
$file = "1.txt";
$fh = fopen($file, 'r');
$theData = fread($fh, filesize($file));
fclose($fh);
echo "<strong>Email 1 - correct outcome: reply needed <br /></strong>";
if (preg_match("/dota(.*?)dota1/s", $theData, $matches))
{
echo $matches[1]."<br />";
}
$respond = 'Respond';
$pos = strpos($matches[1], $respond);
if ($pos === false) {
echo "Reply not needed";
} else {
echo "Reply needed";
}
echo "<HR>";
?>
ありがとう!