PHP头条
热点:

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


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

www.phpzy.comtrue/phprm/25132.htmlTechArticle手机号码验证判断php函数实例讲解 手机号码验证判断php函数 ?php function checkMobile($str) { $pattern = "/^(13|15)d{9}$/"; if (preg_match($pattern,$str)) { Return true; } else { Return false; } } //调用函数 $str = c...

相关文章

    暂无相关文章

PHP之友评论

今天推荐