Skip to content

Instantly share code, notes, and snippets.

@prinick96
Created December 30, 2017 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prinick96/442ce0f32269c956ddc1b61c6be5a67b to your computer and use it in GitHub Desktop.
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
<?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