テキスト ファイルから有効な単語を抽出する PHP コードを作成しました。
$pspell_link = pspell_new("en");
$handle = fopen("list.txt", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
$line = str_replace(' ', '', $line);
$line = preg_replace('/\s+/', '', $line);
if (pspell_check($pspell_link, $line))
{
echo $line."<br>";
}
}
}
list.txt に含まれていると仮定しましょう
ぐふふふ こんにちは、こんにちは。
上記のコードは : Hello のみを出力します。
私がやろうとしているのは、Hellothere を印刷することと、Hello and there という 2 つの有効な単語が含まれていることです。