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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -