Process large textfiles using PHP
I have a textfile with millions of rows. I want to collect one word from each row. The first thing that came to mind was an array, but that would allocate so much memory and it's just not a practical solution because of that.

The reason to why I find an array interesting is that it would be extremely simple to compare the array with another array at a later stage and find the words that only exist in one of the files.

I suppose I could read all the words into a database and take it from there. Any other solutions? Thanks in advance!