Heh, I posted this to the old thread, didn't realize there was a new one...so just to make sure you get it. The code jnuneznyc is much cleaner but if I am thinking right this one might run faster on large search strings. Which one is better I guess comes down to whether speed or readability of code is more important.
Kudos to jnuneznyc. Using an array as the third value in str_replace never even occured to me
-----------------Old Post
That should be no problem just drop the following code in above what I gave you before.
One thing to note is you are going to need to create a function to add 1 space to the begining AND end of a word. This will then be used on every word in your minor word list. The reason for this is that if you were to just search for and remove and remove the string 'the'. It would also modify words such as 'thermometer' to just 'rmometer'. Clearly not what is needed.
//The function to add whitespace
function addWhitespace (&$word, $key) {
$word = " $word ";
}
//Modify the keyphrase so ALL words are surrounded by spaces
//(Mainly the begining and the ending words are of concern)
$keyphrase = " $keyphrase ";
//Do the same to the minor words
array_walk($minorword, 'addWhitespace');
//Remove Minor Words
$keyphrase = str_replace($minorword, '', $keyphrase);
//Take care of potential whitespace problems.
$keyphrase = str_replace(' ', ' ', $keyphrase);
$keyphrase = trim($keyphrase);
Give that a shot