The simplest and most practical regular expression for php mobile phone numbers. For more information, see. mobile: 134, 135, 136, 137, 138, 139, 150, 151, 157 (TD), 158, 159, 187, 188 Unicom: 130... the simplest and most practical regular expression for php mobile phone numbers. For more information, see.
Mobile: 134, 135, 136, 137, 138, 139, 150, 151, 157 (TD), 158, 159, 187, 188
China Unicom: 130, 131, 132, 152, 155, 156, 185, 186
China Telecom: 133, 153, 180, 189 (1349 Weitong)
The instance code of the mobile phone number rule is as follows:
$regex = "/13[0-9]{9}|15[0|1|2|3|5|6|7|8|9]\d{8}|17[0|1|2|3|5|6|7|8|9]\d{8}|18[0|5|6|7|8|9]\d{8}/";
The code used to determine the mobile phone number is as follows:
function is_mobile($str){ return preg_match("/^(((\d{3}))|(\d{3}-))?13\d{9}$/", $str); }
The instance code is as follows:
Finally, all mobile phone numbers can be verified.
The instance code is as follows:
Preg_match_all ($ regex, $ row ['mobile'], $ phones); if ($ phones) {correct}
Friendly reminder: it is really difficult to judge the mobile phone number, because the mobile phone number has changed a lot. maybe you have written a regular expression today, and a new number segment will be generated tomorrow. make a cell phone number segment array and determine whether the array is in the number segment = array (130,131,132 .....) in_array (substr (number, 0, 3), array)
Tip: Add CIDR block 180 and CIDR block 170.
Address:
Reprinted at will, but please attach the article address :-)