php判断字符是否全是中文

主要用于表单认证,认证中文姓名。

// 判断全是中文
function is_znstr($str){
    if(!eregi("[^\x80-\xff]",$str)){
        return true;
    }else{
        return false;
    }

}

你可能感兴趣的:(php判断字符是否全是中文)