function valid_phone_number in Phone 7
Same name and namespace in other branches
- 5 phone.module \valid_phone_number()
- 6 phone.module \valid_phone_number()
Verification for Phone Numbers.
Parameters
string $countrycode:
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
41 calls to valid_phone_number()
- AUPhoneNumberTestCase::testPhoneAUInvalid in tests/phone.au.test 
- AUPhoneNumberTestCase::testPhoneAUValid in tests/phone.au.test 
- BEPhoneNumberTestCase::testPhoneBEInvalid in tests/phone.be.test 
- BEPhoneNumberTestCase::testPhoneBEValid in tests/phone.be.test 
- BRPhoneNumberTestCase::testPhoneBRInvalid in tests/phone.br.test 
File
- ./phone.module, line 346 
Code
function valid_phone_number($countrycode, $phonenumber) {
  $countrycode = trim($countrycode);
  $phonenumber = trim($phonenumber);
  if (phone_supported_countrycode($countrycode)) {
    $valid_phone_function = 'valid_' . $countrycode . '_phone_number';
    module_load_include('inc', 'phone', 'include/phone.' . $countrycode);
    if (function_exists($valid_phone_function)) {
      return $valid_phone_function($phonenumber);
    }
  }
  //Country not taken into account yet
  return FALSE;
}