PHP: How To Highlight Search Without Affecting HTML Tags
This class allows you to highlight keywords in the search results without affecting HTML tags. It can exactly highlight the string in double quotes of the keyword. For example:
$highlightedString = Fete_Util_Text_Highlighter::createInstance('<b>', '</b>')
->highlight('PHP rules the world', '"PHP rules" world'); // prints <b>PHP rules</b> the <b>world</b>