I want to be able to check any string for a set of words that i have in an array.
So if i have the words: "it, the,and,for" they will be removed from a string.
I have coded this and its partially working, but i need it to remove exact instances of a word not partial matches, i.e. remove and from a string, but not and out of the word land.
<php>
$mystring='This is my test sentance which will include various words that i want to remove and some that i do not wish to remove for example land';
$wordlist='it,the,and,for,when,we,i,as';
$wordlist_arr=explode(',',$wordlist);
$size=count($wordlist_arr);
foreach ($wordlist_arr as $value)
{
$mystring=ereg_replace("$value([a-zA-Z0-9])"," ",$mystring);
}
print $mystring;
</php>