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...
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