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

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

Jun 13, 2016 am 10:39 AM
functionphpfunctionjudgmentExamplephone numberexplainverify

手机号码验证判断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. ?>

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool