I am using this function to color all the matches in my search. It works on lowercase words, in Cyrillic script, like "search" but not with "Search".
The function:
public function highlight($text='', $word='')
{
if(strlen($text) > 0 && strlen($word) > 0)
{
return (str_ireplace($word, "<span class='highlights'><strong>" . $word . "</strong></span>", $text));
}
return $text;
}
I've been thinking about it but I don't know how I should change it, to make it work. Can you give me advice? Thank you in advance!