Number Validation - Luhn (or MOD 10) Check Algorithm

Introduction

Welcome to the PHP Luhn Validator, designed to provide a PHP script to automatically validate numbers according to the Luhn (or MOD 10) algorithm.

The second mission statement for this site is to help the author better their PHP skills, therefore feedback about the script and any constructive critisism is appreciated and can be directed to: liam@intermedia-online.com

The luhn algorithm is primarily used for the validation of credit card numbers, not only does this provide a catcher for data-entry errors, it also doubles as a weak security tool. The Luhn algorithm is not exclusive to credit cards, it can also be used for social security numbers (US - maybe other countries) through to store cards; this Luhn Validation script is generic and does not discriminate between card types.

The form below allows a user to see Luhn digit check validation in action, simply enter a number and press Submit; the verbose option will output a table showing how the algorithm arrived at its conclusion.

Note: In order for the algorithm to work correctly the PHP script automatically reverses numbers.

Luhn Check Form