<?php
// 判断手机类型的正则验证
// 移动 134,135,136,137,138,139,147,150,151,158,159,157,154,152,188,187,182,183,184
// 联通 130,131,132,155,156,185,186,145
// 电信 133,153,189,180,181,170,177
$phones = array(
'13412345678',
'13112345678',
'13312345678',
'15212345678',
'15312345678',
'15612345678',
'18012345678',
'18712345678',
'18612345678',
'17712345678',
'14712345678',
'14512345678',
'13912345678',
'12345698754',
'19876543210',
'10568795869',
'16859866589'
);
foreach($phones as $phone) {
if(preg_match('#^1(?:33|53|7[0,7]|8[0,1,9])\d{8}$#', $phone)) {
var_dump($phone, "this is dianxin mobile");
// 非电信号码的且属于移动联通号码的归于此类
} else if (preg_match('#^1(?:3[^3]|5[^3]|7[^07]|8[^019]|4[57])\d{8}$#', $phone)) {
var_dump($phone, "this is yidongliantong mobile");
} else {
var_dump($phone, "no match");
}
}