Why does this not work?
$content=file_get_contents('whatever.txt');
$content=str_replace("\r\n","\n",$content); // Convert linebreaks
$content=str_replace("\n",' ',$content); // Remove linebreaks
$content=preg_replace('/\s+/',' ',$content); // Remove all duplicate spaces
$content=preg_replace('/[^a-zA-Z\s]/','',$content); // Remove all non-letters
$content=trim($content);
$content=explode(' ',$content);
Some of the values are still empty spaces:
E.g.
$content[123] = '';
Do I understand something incorrectly? Surely there should be none?
I think that whole thing could be summed up/fixed in these lines: