2015-01-30 09:40:06 +01:00
|
|
|
# PostalCode
|
|
|
|
|
|
|
|
- `v::postalCode(string $countryCode)`
|
|
|
|
|
|
|
|
Validates a postal code according to the given country code.
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::numeric()->postalCode('BR')->validate('02179000'); // true
|
|
|
|
v::numeric()->postalCode('BR')->validate('02179-000'); // true
|
|
|
|
v::numeric()->postalCode('US')->validate('02179-000'); // false
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
2015-09-24 05:47:42 +02:00
|
|
|
Message template for this validator includes `{{countryCode}}`.
|
|
|
|
|
2015-01-30 09:40:06 +01:00
|
|
|
Extracted from [GeoNames](http://www.geonames.org/).
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
|
|
|
* [CountryCode](CountryCode.md)
|