Skip to content

Instantly share code, notes, and snippets.

@dmacompton
Created July 9, 2015 10:41
Show Gist options
  • Save dmacompton/2ddee3ce86e2a2b4082a to your computer and use it in GitHub Desktop.
Save dmacompton/2ddee3ce86e2a2b4082a to your computer and use it in GitHub Desktop.
valid phone number
function validate_phone($phone)
{
$phone = preg_replace("/[^0-9]/",'',$phone);
if(empty($phone) || (strlen($phone) < 8 || strlen($phone) > 16))
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment