I have a text file that is around 1.7MB that has a list of words that I need for my application. I need to have it loaded into an array when the page loads and then be available to other PHP files that AJAX requests are made to. Right now I am loading it into an array on page load and then storing it in a session so that the AJAX file has it available when requests are made to it. Is this the best way to do this?
Share
Really depends on what you are doing with the data. If the AJAX only needs a certain couple of words from that huge list it would probably be best stored in a database.
Do remember that even if the list is stored in a session it will imply that you script loads up that array on every single call. Seams like a huge burden for something that maybe is not really needed.
You don’t give us much detail, though.