You are here

function valid_ch_phone_number in Phone 7

Same name and namespace in other branches
  1. 6 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

include/phone.ch.inc, line 25
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;
}