function valid_pl_phone_number in Phone 6
Same name and namespace in other branches
- 7 include/phone.pl.inc \valid_pl_phone_number()
Verifies that $phonenumber is valid
Parameters
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
File
- ./
phone.pl.inc, line 22 - CCK Field for Poland phone numbers.
Code
function valid_pl_phone_number($phonenumber) {
// define regular expression
$regex = "/^(\\+48\\s+)?\\d{3}(\\s*|\\-)\\d{3}(\\s*|\\-)\\d{3}\$/i";
// return true if valid, false otherwise
return (bool) preg_match($regex, $phonenumber);
}