function valid_cs_phone_number in Phone 7
Same name and namespace in other branches
- 6 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
- include/
phone.cs.inc, line 21  - 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);
}