当前位置:网站首页>PHP get mobile number operator
PHP get mobile number operator
2022-06-26 04:35:00 【On eel like water】
1. Preface
The company has a charging project , The operator who needs to obtain the mobile phone number , Perform different logic .
According to the first three digits of the mobile phone number, you can know the operator of the mobile phone number
Move :134、135、136、137、138、139、150、151、157(TD)、158、159、187、188
Unicom :130、131、132、152、155、156、185、186
telecom :133、153、180、189、(1349 Weitong )
2. PHP The operator who gets the mobile phone number
This is a function I get by looking up data , Test is really available
/**
* Get the mobile number operator
*
* @param $mobile
* @return mobile|union|telcom|unknown Move | Unicom | telecom | Unknown
*/
function getMobileServiceProvider($mobile)
{
$isChinaMobile = "/^134[0-8]\d{7}$|^(?:13[5-9]|147|15[0-27-9]|178|18[2-478])\d{8}$/";
$isChinaUnion = "/^(?:13[0-2]|145|15[56]|176|18[56])\d{8}$/";
$isChinaTelcom = "/^(?:133|153|177|173|18[019])\d{8}$/";
if (preg_match($isChinaMobile, $mobile)) {
return 'mobile'; // Move
} else if (preg_match($isChinaUnion, $mobile)) {
return 'union'; // Unicom
} else if (preg_match($isChinaTelcom, $mobile)) {
return 'telcom'; // telecom
} else {
return 'unknown'; // Unknown
}
}
边栏推荐
- Simple use of redis in laravel
- SixTool-多功能多合一代挂助手源码
- Compiling and installing phpredis extension on MAC
- C generic
- pip 批量完全卸载包
- numpy 数据输入输出
- Report on operation mode and future development trend of China's refining and chemical market 2022-2028
- [Qunhui] this suite requires you to start PgSQL adapter service
- Simple personal summary of tp6 multi application deployment -- Part I [original]
- 1.11 learning summary
猜你喜欢
企业的产品服务怎么进行口碑营销?口碑营销可以找人代做吗?
Double buffer technology asynchronous log system
2021/11/6-burpsuit packet capturing and web page source code modification
CDN with OSS acceleration
Laravel framework Alipay payment fails to receive asynchronous callback request [original]
The statistics in the MySQL field become strings, and then they are converted into numbers for sorting
OSS CDN alicloud configuration method
MySQL enable logbin in Qunhui docker
Tp6 controller does not exist: app\index\controller\index
[H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface
随机推荐
SixTool-多功能多合一代挂助手源码
PHP small factory moves bricks for three years - interview series - my programming life
Use of better scroll
Database design (I)
Mysql8.0 configuring my SQL in INI file_ mode=NO_ AUTO_ CREATE_ User can start
Modify the number of Oracle connections
Install Damon database
CTF PHP audit bypasses filtering learning from topics
Nightmare
Zhubo Huangyu: all the precious metals you want to know are here
Redis cache message queue
Composer version rollback version switching
Implementation of seven classes of BlockingQueue interface
Jenkins introduces custom jars
Nabicat连接:本地Mysql&&云服务Mysql以及报错
Compiling and installing phpredis extension on MAC
Analysis report on development trend and market demand of global and Chinese molecular diagnostics industry from 2022 to 2028
Zeromq from getting started to mastering
[Qunhui] command line acme SH automatically apply for domain name certificate
Clean up photo SCR virus / iframekill injection removal /iframekill removal photo scr