ok i got this code somewhat to work with a search egine im making.
next question. what if the word to be highlighted for contains more than one word, i dont want it to search for that exact string,rather highlight the words invidually:
Lets say I have the sentence:
My dog jumped over the fence and it broke its leg
here is the code i havenow
$code = str_replace($hlt, "<span class=search_term>$hlt</span>", $code);
ok, now lets say $hlt = "dog broke fence"
Well, of course, the ONLY WAY anythign will be highlighted is if the EXACT phrase "dog broke fence". In the sentene above, it isnot.
I want each word highlited individually. Any ideas on how this is possible?