I have created a PHP code that extracts valid words form a text file :
$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>";
}
}
}
Let's assume that the list.txt contains
ghgh fghy Hello Hellothere
The code above will print only : Hello
What I'm trying to do is to print Hellothere as well as it contains two valid words Hello and there
(Edited)
You can try to pass constant
PSPELL_RUN_TOGETHER
as option:From PHP documentation:
Furthermore, replacing all spaces in the
line
, you pass a string like "ghghfghyHelloHellothere" topspell_check()
Try instead exploding: