Cake\Localized\Validation\ItValidation::postal PHP 메소드

postal() 공개 정적인 메소드

Checks a postal code for Italy.
public static postal ( string $check ) : boolean
$check string The value to check.
리턴 boolean Success.
    public static function postal($check)
    {
        $pattern = '/^[0-9]{5}$/i';
        return (bool) preg_match($pattern, $check);
    }

Usage Example

예제 #1
0
 /**
  * test the postal method of ItValidation
  *
  * @return void
  */
 public function testPostal()
 {
     $this->assertTrue(ItValidation::postal('10096'));
     $this->assertFalse(ItValidation::postal('1046'));
 }