The code snippet given below explains every step of the program.
Searching keyword table for every word is a long process. This also reduces the efficiency of the program. To implement this
all the keywords in the keyword table is stored in an associative array $allWords. An associative array is one, which works
on B-Tree algorithm and very useful to perform searches. Here is the function.
<?php
Function LoadCurrentWords(){
global $allWords;
$result = mysql_query( "select keyid, keyword from keytable" ) or die( "Error in executing mysql query" );
$COMMON_WORDS is an associative array that stores an array of words, which are commonly used
in English Language. These words have to be removed while parsing the file.
$COMMON_WORDS=array(a=>1, as=>1);
You can add as many common words as you like. See source code for full list of common words.