I use this function to highlight mysql query results:
function highlightWords($string, $word)
{
$string = str_replace($word, "<span class='highlight'>".$word."</span>", $string);
return $string;
}
....
$cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result);
the problem is that if I type “good”, it will only show my search results in lowercase “g'ood” and not “Good”. How to fix it?
input source
share