Q: Most efficient way to run a check against a large number of words I'm running a education software application.  In the reading text section, I want to identify words that are in a word-list, and output a popup hover for those words. The word-list has about 30,000 words in it.  I can put it into a MySQL table ~~or.... is there any more efficient way?  
Specifically with respect to efficient, I mean reducing my server load.  If the reading text has 500 words, that's about 400 MySQL calls to check each word (after eliminating basic words using a smaller array.)

A: If you simple want to compare all words passed by the user, you can also put all your words in one variable (not in array! in one line text), and by using strpos you will find them. I think it will be very fast!
$mywords = "word1 word2 word3 word4 ....... word40000"; 
$userWords = array('word2','other'); 
foreach($userWords as $word) {
    if(strpos($mywords, $word)!==false)
    {
        // you found a word!
    } 
}

