PHP regular expression to verify mobile phone number

WBOY
Release: 2016-07-25 09:13:15
Original
1265 people have browsed it

Example, php regular expression to verify mobile phone and phone number.

  1. function check_telnum1($telnum)
  2. {
  3. $b1 = (preg_match("/^(0[0-9]{2,3}[-]?[2-9] [0-9]{6,7}[-]?[0-9]?)$/i",$telnum))?TRUE:FALSE;// Phone
  4. $b2 = (preg_match("/^(1 [358]{1}[0-9]{9})$/i",$telnum))?TRUE:FALSE;//Mobile phone
  5. return $b1 || $b2;
  6. }
Copy code


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template