$str="hello world 你好世界~"; $num = preg_match_all("/[a-zA-Z]/",$str,$words); echo $num; print_r($words); $num = preg_match_all("/[\xB0-\xF7][\xA1-\xFE]/",iconv('UTF-8','GBK',$str),$words);