eXorithm – Execute Algorithm: View / Run Algorithm validate_phone

Logo Beta

function validate_phone ($number

{

  $number = preg_replace"/[().- ]/"''$number);

  $valid = "/^1?[2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4}$/"

  if ( preg_match$valid$number ) == 1 ) {

    return true;

  } else {

    return false;

  }