function valid_pk_phone_number in Phone 7
Same name and namespace in other branches
- 6 phone.pk.inc \valid_pk_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.pk.inc, line 21 - CCK Field for Pakistanese phone numbers.
Code
function valid_pk_phone_number($phonenumber) {
// define regular expression
$regex = "/^(\\+)?([9]{1}[2]{1})?-? ?(\\()?([0]{1})?[1-9]{2,4}(\\))?-? ??(\\()?[1-9]{4,7}(\\))?\$/i";
// return true if valid, false otherwise
return (bool) preg_match($regex, $phonenumber);
}