public static function postal($check) { $pattern = '/\\A\\b[0-9]{4}\\b\\z/i'; return (bool) preg_match($pattern, $check); }
/** * test the postal method of DkValidation * * @return void */ public function testPostal() { $this->assertTrue(DkValidation::postal('4444')); $this->assertFalse(DkValidation::postal('333')); $this->assertFalse(DkValidation::postal('55555')); }