Home  >  Article  >  php教程  >  PHP 匹配中文字符

PHP 匹配中文字符

PHP中文网
PHP中文网Original
2016-05-24 12:52:491432browse

PHP 匹配中文字符

$str = "welcome,to 上海e2003网页.net服务中心.";

$pattern = "/^[\x00-\xff]+$/";
preg_match_all("/[\x{4e00}-\x{9fa5}]+/u",$str,$match);

print_r($match);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn