Make certain characters of a word from a string bold
I need to highlight certain characters from a string, I tried str_replace and preg_replace. But they only work when you enter a full word,
$text = str_replace($searhPhrase, '<b>'.$searhPhrase.'</b>', $text);
$text = preg_replace('/('. $searhPhrase .')/i', '<b>$1</b>', $text);
I need something like, if I'm looking for "and", even the letters from "hand" should be selected.
Thanks in advance.
+3
source to share