How to replace matching characters in two sets of strings with bolded characters? – PHP
currently working on a following function: public function boldText($searchSuggestions) { $search = $this->getRequestParameter('search'); $pattern = "/".$search."/u"; $searchSuggestions = preg_replace($pattern, '<b>'.$search.'</b>', $searchSuggestions); echo $searchSuggestions; } Let's say $searchSuggestions = hello While the user is typing in the search box, which in…