php 封装函数正则判断是否是手机号码11位正确

/**
 * 验证手机号
 * @param $mobile
 * @return bool
 */
function is_mobile($mobile)
{
    if(empty($mobile)) return false;

    $eg = '/^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199)\d{8}$/';

    if(preg_match($eg, $mobile)){

        return true;
    }else{
        return false;

    }
}

  

posted on 2020-07-28 19:28  githup  阅读(940)  评论(1)    收藏  举报

导航