0

this is my code in php:

  if ($q !== "") {
  $q = strtolower($q);
  $len=mb_strlen($q);
  foreach($a as $name) {   
    if (preg_match("/\b$q/i",$name)) {
        if ($hint === "") {
            $hint = $name;
        } else {
            $hint .= ",$name";
        }
    }
    }
   }

this work properly. but I want to use unicode strings(UTF-8) not ascii strings, so I'm using mb_ereg_match() instead. but it doesn't work. I thing that I should change the pattern. but I don't know how?

if ($q !== "") {
$q = mb_strtolower($q,'UTF-8');
$len=mb_strlen($q,'UTF-8');
foreach($a as $name) {

    if(mb_stristr($name,$q)){

   if ($m=mb_ereg_match("/\b$q/i",$name)) {
        if ($hint === "") {
            $hint = $name;
        } else {
            $hint .= ",$name";
        }


   }
 }
Hamid
  • 1
  • 1
  • 2

0 Answers0