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