If you create a second instance of the statistics module, the first one has already loaded all the words with include_once so the second instance doesn't get the words.
I suggest making a TextStatistics::instance() method which returns an instance, and stores it in a static variable in the class, so if you run it again you get the same object not a new one.
If you create a second instance of the statistics module, the first one has already loaded all the words with include_once so the second instance doesn't get the words.
I suggest making a TextStatistics::instance() method which returns an instance, and stores it in a static variable in the class, so if you run it again you get the same object not a new one.