Return to Snippet

Revision: 7001
at July 1, 2008 09:33 by aristoworks


Initial Code
$string = "(232) 555-5555";
if (preg_match('/^\(?[0-9]{3}\)?|[0-9]{3}[-. ]? [0-9]{3}[-. ]?[0-9]{4}$/', $string)) { 
echo "example 2 successful.";
}

Initial URL
http://www.thejwalker.com

Initial Description
A simple method of validating a telephone number using regular expressions and PHP

Initial Title
PHP (RegEx) Telephone Number Validation

Initial Tags
php, phone, number, simple, validation

Initial Language
PHP