function valid_ch_phone_number in Phone 6
Same name and namespace in other branches
- 7 include/phone.ch.inc \valid_ch_phone_number()
Verification for private/standr switzerland Phone Numbers (E.164/2002). According to http://en.wikipedia.org/wiki/Telephone_numbers_in_Switzerland#After_2002 (Released 2002)
Parameters
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
File
- ./
phone.ch.inc, line 26 - CCK Field for Switzerland phone numbers.
Code
function valid_ch_phone_number($phonenumber) {
$phonenumber = str_replace(array(
' ',
'-',
'.',
'/',
'(',
')',
), '', $phonenumber);
$match = array();
$result = (bool) preg_match(PHONE_CH_REGEX, $phonenumber, $match);
return $result;
}