手机号中间四位转*号

/**
     * 手机号中间四位转*号
     * @param $tel 手机号码
     * @return mixed
     */
    public function mobile_change($tel){
        $str = substr($tel,0,3);
        $strs = substr($tel,0,4);
        if ($str == '+86'){
            $tel_sub = substr($tel,3,11);
        }elseif ($strs == '+852' || $strs == '+853' || $strs == '+886'){
            $tel_sub = substr($tel,4,11);
        }
        return substr_replace($tel_sub, '****', 3, 4);
    }

猜你喜欢

转载自www.cnblogs.com/clubs/p/9152056.html