この関数を使用して、mysqlクエリの結果を強調表示しています。
function highlightWords($string, $word)
{
$string = str_replace($word, "<span class='highlight'>".$word."</span>", $string);
/*** return the highlighted string ***/
return $string;
}
....
$cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result);
問題は、「good」と入力すると、検索結果が小文字の「g」でのみ表示され、「Good」では表示されないことです。これを修正するにはどうすればよいですか?