public static addressCode ( string $check ) : boolean | ||
$check | string | The value to check. |
return | boolean | Success. |
public static function addressCode($check)
{
$pattern = '/^[0-9]{6}$/';
return (bool) preg_match($pattern, $check);
}
/** * test the address_code method of RsValidation * * @return void */ public function testAddressCode() { $this->assertTrue(RsValidation::addressCode('122407')); $this->assertFalse(RsValidation::addressCode('11090')); $this->assertFalse(RsValidation::addressCode('A11090')); }