public static function postal($check) { $pattern = '/^[0-9]{4}$/'; return (bool) preg_match($pattern, $check); }
/** * test the postal method of AuValidation * * @return void */ public function testPostal() { $this->assertTrue(AuValidation::postal('2300')); $this->assertFalse(AuValidation::postal('02300')); }