skip to Main Content

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…

VIEW QUESTION

How to check only alphanumeric and other language alphabet by using preg_replace? – SEO

I need to create a SEO friendly string only from alphanumeric and characters of my native language. It is sinhala. My expected string should be something like this: $myString = "this-is-a-දහසක්-බාධක-දුක්-කම්කටොලු-මැදින්-ලෝකය-දිනන්නට-වෙර-දරන"; I am using a function to create the string…

VIEW QUESTION
Back To Top
Search