Mobile phone number verification judgment php function
- function checkMobile($str)
- {
- $pattern = "/^(13|15)d{9}$/";
- if (preg_match($pattern,$str))
- {
- Return true;
- }
- else
- {
- Return false;
- }
- }
- //Call function
- $str = checkMobile("15800000001");
- if($str)
- {
- echo ("Conforms to mobile phone number standards");
- }
- else
- {
- echo("Does not meet mobile phone number standards");
- }
- ?>
-
http://www.bkjia.com/PHPjc/486215.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486215.htmlTechArticleMobile phone number verification and judgment php function?php function checkMobile($str) { $pattern = "/^(13| 15)d{9}$/"; if (preg_match($pattern,$str)) { Return true; } else { Return false; } } //Call function...