Home >Backend Development >PHP Tutorial >PHP verification mobile phone number and phone number regularity_PHP tutorial

PHP verification mobile phone number and phone number regularity_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-15 13:22:031281browse

function funcphone($str)//电话号码正则表达试
{
 return (preg_match("/^(((d{3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,8}$/",$str))?true:false;
} //使用方法

if( funcphone ('0731-88888888'))
{
 echo '正确电话号码';
}
else
{
 echo '对不起,您输入的电话号码不正确';
}


function funcmtel($str)//手机号码正则表达试
{
 return (preg_match("/(?:13d{1}|15[03689])d{8}$/",$str))?true:false;
}

//手机号验证应用

if( funcmtel( '13875888888') )
{
 echo '你输入手机号码是正确的';
}
else
{
 echo '请输入合法中国移动或联动手机号';
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/447008.htmlTechArticlefunction funcphone($str)//Telephone number regular expression try { return (preg_match(/^(((d {3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,8}$/,$str ))?true:false;} //Use method if( funcphone (0...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn