-
Couldn't load subscription status.
- Fork 0
Structure of NINs
Each country have their own way of identifying individuals. This document aims to describe all scenarios, and how php-nin is parsing and validating each country's identification number (NIN).
Personal Identity Number (Swedish: personnummer)
- YYMMDD±NNNC
- YYYYMMDDNNNC
There are two similar formats, where the first variant is the official format according to law, but the second is more common.
On the day a person reaches 100 years of age, the separator changes from a dash (-) to a plus (+). Because the official format is dependant on the current time, the second format is to be preferred when saving information to a database, which is in fact described in the law as well.
The first three digits after the separator represent a serial number to differentiate people born on the same day. Because of this, only 1000
The second last digit is odd for males, and even for females.
The last digit is a checksum digit, which is calculated using the Luhn-algorithm.
// todo: explain luhn
improve more
// todo: add other countries