$str = '写一个hello world程序';
//GBK/GB2312使用:
$result = preg_match_all("/[\x80-\xff]+/", $str, $matches);
// UTF-8 使用:
$result = preg_match_all("/[\x{4e00}-\x{9fa5}]+/u", $str, $matches);
echo '<pre>';print_r($matches);exit;
结果都是:
Array
(
[0] => Array
(
[0] => 写一个
[1] => 程序
)
)