i\'m using this function to highlight the results from mysql query:
function highlightWords($string, $word) { $string = str_replace($word, \"
Use str_ireplace() instead.
str_ireplace()
EDIT: Here is regexp version that keeps original case:
$string = preg_replace("/".preg_quote($word, "/")."/i", "$0", $string);