Created
December 30, 2017 19:12
-
-
Save prinick96/442ce0f32269c956ddc1b61c6be5a67b to your computer and use it in GitHub Desktop.
Verifica si un número de teléfono es válido en Venezuela en PHP
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 | |
/** | |
* Verifica si un número de teléfono es válido en Venezuela | |
* El formato debe ser 0414/0412/0416/0424/0426/0422-1234567 | |
* | |
* @param string $phone : Número de teléfono | |
* | |
* @return bool (true si es válido, false si no) | |
*/ | |
function is_venezuelan_phone(string $phone) : bool { | |
return preg_match('/^04[1-2](4|6|2)-[0-9]{7}/',$phone); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment