i\'m using this code to highlight search keywords:
function highlightWords($string, $word) { $string = str_replace($word, \"
as suggested by user187291, just change following code in order to get text highlighted with yellow background.
return preg_replace($re, '$0', $text);