0

I'm working in this function that colors an username in case it exists @username within an string.

PHP

$string="this **text** contains a second **content**"

I want to bold the text contained within text

I tried but nothing

 function bold_word($string) {
   return preg_replace('/(\**+)/', "<b>$1</b>", $string);
    }
joe
  • 219
  • 2
  • 11

0 Answers0