function valid_cs_phone_number in Phone 6
Same name and namespace in other branches
- 7 include/phone.cs.inc \valid_cs_phone_number()
Verifies that $phonenumber is a valid nine-digit Czech phone number
Parameters
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
File
- ./
phone.cs.inc, line 22 - CCK Field for Czech phone numbers.
Code
function valid_cs_phone_number($phonenumber) {
$phonenumber = trim($phonenumber);
// define regular expression
$regex = '/^((?:\\+|00)420)? ?(\\d{3}) ?(\\d{3}) ?(\\d{3})$/';
// return true if valid, false otherwise
return (bool) preg_match($regex, $phonenumber);
}