php_passport_check is a function to check the validity of a passport id (the last line of a passport).

php_passport_check is known to work with passports of these countries.

php_passport_check probably also works for other countries and several national id cards. If you own any of these, please try these out and report your mileage. For more details see testing.


php_passport_check can be used as an easy way to the age. This method is not fool proof as generators for passport numbers do exist.

Legal requirements for hosting adult content require a user to prove his age in some countries. Entering fake passport numbers is a criminal offence (document fraud). Therefor we think it is better than no check at all.

We do not provide legal advice nor do we guarantee that the use of php_passport_check will stand in court.


The last line of the ID contains the following information:

For more information about the format check format.txt.


As all information about the system is gathered from various sources and testing, please check if php_passport_check works for you.

Please see how to test


See samples/ for some quick examples of how php_passport_check can be used.



php_passport_check is free software and published under the terms of the GNU General Public License


php_passport_check was written by Oliver Lenzko <oliver at lenzko dot de>



Perso is a Validator for German ID-cards written in C++. Logo