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