is it possible to run str_ireplace without it destroying the original casing?
For instance:
$txt = \"Hello How Are You\";
$a = \"are\";
$h = \"hello\
I think you'd want something along these lines: Find the word as it is displayed, then use that to do the replace.
function highlight($word, $text) {
$word_to_highlight = substr($text, stripos($text, $word), strlen($word));
$text = str_ireplace($word, "".$word_to_highlight."", $text);
return $text;
}