public static function postal($check) { $pattern = '/^[0-9]{6}$/'; return (bool) preg_match($pattern, $check); }
/** * test the postal method of RoValidation * * @return void */ public function testPostal() { $this->assertTrue(RoValidation::postal('517006')); $this->assertFalse(RoValidation::postal('23708')); $this->assertFalse(RoValidation::postal('23 708')); }