I'm trying to use str_replace to match whole words, but have only been able to match just the string, even if it's part of the word.
To just to see it match, I used this code:
$tmpstring = str_replace($db_term , strtoupper($db_term) , $tmpstring);
For instance, if the db_term is "aft" then it finds "after" and replaces it with "AFTer".
I've even tried this bit of code:
$tmpstring = preg_replace("/($db_term)/i" , "<font color=red>" . $db_term ."</font>" , $tmpstring);
Same thing.
Any ideas?