Just go to the code
1
2 $string="Hello, hello world";
3 preg_match('~[x{4e00}-x{9fa5}]+~u', $string, $array);
4
5
6 print_r ( $array );
Print result:
1 Array
2 (
3 [0] => Hello
4)
Note: The encoding is UTF-8. GBK is not written like this.
Author: yangqijun
http://www.bkjia.com/PHPjc/478128.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478128.htmlTechArticleGo directly to the code 1?php 2$string=Hello, hello world; 3preg_match(~[x{ 4e00}-x{9fa5}]+~u, $string, $array); 4 5 6print_r ( $array ); Print result: 1Array 2( 3 [0] = Hello...
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