php手机号码验证判断函数
最简单的最实用的php手机号码正则表达式,有需要的朋友可参考参考。
移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188
联通:130、131、132、152、155、156、185、186
电信:133、153、180、189、(1349卫通)
手机号规则
代码如下 | 复制代码 |
$regex = "/13[0-9]{9}|15[0|1|2|3|5|6|7|8|9]d{8}|18[0|5|6|7|8|9]d{8}/"; |
例1
判断手机号码:
代码如下 | 复制代码 |
function is_mobile($str){ |
实例
代码如下 | 复制代码 |
|
最后完全可以验证目前所有手机号代码
代码如下 | 复制代码 |
preg_match_all($regex,$row['mobile'], $phones); |
友情提示,现在关于手机判断的,确实不太好做了,因为手机号码变化已经比较大了.可能今天你写了正则,明天就出了新的号码段了,做个手机号码段数组的,判断是否在号码段内数组=array(130,131,132.....)in_array(substr(号码,0,3),数组)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool