Forum Moderators: coopster
For example, if i search for "dog" and one of the results is:
* Dog contest winner
Last friday an Akita dog won the dog contest...
The result SHOULD come up as:
* Dog contest winner
Last friday an Akita (STRONG)dog(/STRONG) won the dog contest...
--I dont quite get the reg.expressions... but i know that this could be accomplished with preg_replace. I would really appreciate some help in here.
Andres
$pattern = "/(".$keyword.")/i";
$replace = "<strong>\\1</strong>";
echo preg_replace($pattern,$replace,$string);
Again you may want to make sure that it is only the keyword by itself, and not the keyword within another word.