function valid_it_phone_number in Phone 7
Same name and namespace in other branches
- 5 phone.it.inc \valid_it_phone_number()
- 6 phone.it.inc \valid_it_phone_number()
Verifies that $phonenumber is valid
Parameters
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
File
- include/
phone.it.inc, line 21 - CCK Field for Italian phone numbers.
Code
function valid_it_phone_number($phonenumber) {
// define regular expression
$regex = "/^(\\+39)?[ ]?([0-9]{2,3}(\\/|-| )?[0-9]{6,7})\$/i";
// return true if valid, false otherwise
return (bool) preg_match($regex, $phonenumber);
}