Copy codeThe Code is as follows:
<? Php
// Regular Expression
$ Tel = "15558530459"; // The author's mobile phone number, if you have any questions can contact me by phone, or QQ contact me, My QQ is mezongzi@qq.com
If (strlen ($ tel) = "11 ")
{
// The above part determines whether the length is 11 characters long
$ N = preg_match_all ("/13 [123569] {1} \ d {8} | 15 [1235689] \ d {8} | 188 \ d {8 }/", $ tel, $ array );
/* The subsequent regular expression ("/131,132,133,135,136,139 starts with any 8 followed by a number '|' (OR)
* Any 8 digits starting with 151,152,153,156,158.159
* If the number starts with 188 and then any 8 is a number, matching any group of numbers will pass.
*/")*/
Var_dump ($ array); // check whether it is found. If it is found, the phone number is output.
} Else
{
Echo "the length must be 11 characters ";
}
/*
* Although it looks complicated, it's easy to understand!
* If it is better, you can post it and share your happiness!
**/
?>