I could do that, but I didn't think of this before, just check the phone number against two regular expressions (one with the area code, and one without it) like so:
PHP Code:
if (preg_match("/[0-9]{3}?-[0-9]{3}-[0-9]{4}/", "555-555-5555") || preg_match("/[0-9]{3}?-[0-9]{4}/","555-5555")) {
echo "Valid phone number.<br />";
} else {
echo "Invalid phone number.<br />";
}
I think that is more simple, and it still does work.
