1. The implementation code is as follows
/** * Verify phone number * @param [type] $tel [description] * @return [type] [description] */function validatephoneno ($tel) {//Regular expression if (strlen ($tel) == "one") { // The upper part of the judging length is not 11 bits $n = preg_match_all ("/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/", $tel, $array ); /* the next regular expression ("/131,132,133,135,136,139 begins followed by any 8 for the number ' | ' (or meaning) * 151,152,153,156,158.159 begins with any 8 for the number * or 188 to begin with any 8 for the number, Match any one of these groups passed the * /") */if (Empty ($array)) {return false;} Return true;} Else{ return false;} }
This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1939080
PHP Verification Phone Number