You are here

function valid_it_phone_number in Phone 6

Same name and namespace in other branches
  1. 5 phone.it.inc \valid_it_phone_number()
  2. 7 include/phone.it.inc \valid_it_phone_number()

Verifies that $phonenumber is valid

Parameters

string $phonenumber:

Return value

boolean Returns boolean FALSE if the phone number is not valid.

File

./phone.it.inc, line 22
CCK Field for Italian phone numbers.

Code

function valid_it_phone_number($phonenumber) {

  // define regular expression
  $regex = "/^(\\+39)?[ ]?([0-9]{2,3}(\\/|-| )?[0-9]{6,7})\$/i";

  // return true if valid, false otherwise
  return (bool) preg_match($regex, $phonenumber);
}