Make certain characters of a word from string bold
PHP Snippet 1:
$text = preg_replace('/\S*('. $searhPhrase .')\S*/i', '<b>$1</b>', $text);
PHP Snippet 2:
$text = preg_replace('/(\S*'. $searhPhrase .'\S*)/i', '<b>$1</b>', $text);
PHP Snippet 3:
function strReplace($searchText,$mainText){
return str_replace($searchText, '<b>'.$searchText.'</b>', $mainText);
}