There is a function for message processing in my program. This function read thousand lines of strings from a text file to create an array ($dictionary). The function uses the $dictionary to detect and process the words in a message.
This function is called every time when a user send a message to the server. Each user need to send around 20-100 messages per session (similar to chatting). I don't want the $dictionary to be created each time when a message is received. Is there a more efficient way for doing this?
Is there a more efficient way for this program?
Moderator: General Moderators
Re: Is there a more efficient way for this program?
Well, for a start, by the sounds of things it'd be more efficient to put the dictionary into a database table and then build an array of the words in the message rather than everything.