Created
February 19, 2016 08:24
-
-
Save d1i1m1o1n/af13ddce62588a836d29 to your computer and use it in GitHub Desktop.
Is phone function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isPhone($val){ | |
if (!preg_match('/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/iu', $val)) | |
return false; | |
return true; | |
} | |
//allow | |
/* | |
+79261234567 | |
89261234567 | |
79261234567 | |
+7 926 123 45 67 | |
8(926)123-45-67 | |
123-45-67 | |
9261234567 | |
79261234567 | |
(495)1234567 | |
(495) 123 45 67 | |
89261234567 | |
8-926-123-45-67 | |
8 927 1234 234 | |
8 927 12 12 888 | |
8 927 12 555 12 | |
8 927 123 8 123 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment