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
Release: 2016-07-15 13:22:03
Original
1280 people have browsed it

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 '请输入合法中国移动或联动手机号';
}
Copy after login

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 of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template