mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 07:45:45 +01:00
20 lines
485 B
Markdown
20 lines
485 B
Markdown
# PostalCode
|
|
|
|
- `v::postalCode(string $countryCode)`
|
|
|
|
Validates a postal code according to the given country code.
|
|
|
|
```php
|
|
v::numeric()->postalCode('BR')->validate('02179000'); // true
|
|
v::numeric()->postalCode('BR')->validate('02179-000'); // true
|
|
v::numeric()->postalCode('US')->validate('02179-000'); // false
|
|
```
|
|
|
|
Message template for this validator includes `{{countryCode}}`.
|
|
|
|
Extracted from [GeoNames](http://www.geonames.org/).
|
|
|
|
***
|
|
See also:
|
|
|
|
* [CountryCode](CountryCode.md)
|