Php check if the string has Chinese chars -
i have string $str
, want check if it`s content has chinese chars or not (true/false)
$str = "赕就可消垻,只有当所有方块都被消垻时才可以过关";
can please me?
thanks! adrian
you use unicode character class http://www.regular-expressions.info/unicode.html
preg_match("/\p{han}+/u", $utf8_str);
this checks presence of @ least 1 chinese character. might want expand on if want match complete string.
Comments
Post a Comment