Home > Backend Development > PHP Tutorial > Regular verification of mobile phone number problem

Regular verification of mobile phone number problem

WBOY
Release: 2016-09-20 03:30:03
Original
1086 people have browsed it

if (!preg_match('/0?(00|01|11|13|14|15|17|18)[0-9]{9}/', $tel)) {

<code>    }
    
    </code>
Copy after login

Why does this regex allow mobile phone numbers with more than 11 digits to pass through directly without reporting an error? 00 and 01 11 are customized, just ignore them
The regex is not very good. What is wrong? How should I write it?

Related labels:
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