phone() public static method

It is not a strict rule and should cover almost all legal phone numbers. Some (obviously) illegal phone numbers will pass this test, especially cellphone. Since it will be a hard task to maintain a small cellphone prefix "database", just make it simple for now.
public static phone ( string $check ) : boolean
$check string The value to check.
return boolean Success.
Beispiel #1
0
 /**
  * test the phone method of CnValidation
  *
  * @return void
  */
 public function testPhone()
 {
     $this->assertTrue(CnValidation::phone('+86-010-27738066'));
     $this->assertTrue(CnValidation::phone('13901005000'));
     $this->assertTrue(CnValidation::phone('008613901005000'));
     $this->assertTrue(CnValidation::phone('+8613901005000'));
     $this->assertTrue(CnValidation::phone('010-1234567'));
     $this->assertTrue(CnValidation::phone('0591-88888888'));
     $this->assertTrue(CnValidation::phone('010-12345678-123'));
     $this->assertFalse(CnValidation::phone('123123'));
     $this->assertFalse(CnValidation::phone('123123123xx'));
     $this->assertFalse(CnValidation::phone('0591-110'));
     $this->assertFalse(CnValidation::phone('1234567'));
 }