输入banner图图片脚本导航/分类

手机号码验证判断php函数实例讲解_PHP教程

手机号码验证判断php函数
  1. function checkMobile($str)
  2. {
  3. $pattern = "/^(13|15)d{9}$/";
  4. if (preg_match($pattern,$str))
  5. {
  6. Return true;
  7. }
  8. else
  9. {
  10. Return false;
  11. }
  12. }
  13. //调用函数
  14. $str = checkMobile("15800000001");
  15. if($str)
  16. {
  17. echo("符合手机号码标准");
  18. }
  19. else
  20. {
  21. echo("不符合手机号码标准");
  22. }
  23. ?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486215.htmlTechArticle手机号码验证判断php函数 ?php function checkMobile($str) { $pattern = "/^(13|15)d{9}$/"; if (preg_match($pattern,$str)) { Return true; } else { Return false; } } //调用函数...