public static function phone($check)
{
$pattern = '/^((8|\\+38)-?)?(\\(?+...\\)?)?-?\\d{3}-?\\d{2}-?\\d{2}$/';
return (bool) preg_match($pattern, $check);
}
/** * test phone method of UaValidation * * @return void */ public function testPhone() { $this->assertTrue(UaValidation::phone('+38-044-283-93-57')); $this->assertTrue(UaValidation::phone('(068)2839357')); $this->assertTrue(UaValidation::phone('+380442839357')); $this->assertFalse(UaValidation::phone('+38 (063)537-28-07')); $this->assertTrue(UaValidation::phone('8044223-95-26')); $this->assertTrue(UaValidation::phone('+380612839357')); }