You could use an algorithms called mod10.  Both Visa, MasterCard and I think
most other credit cards use the mod10 algorithm.  A credit card must pass a
mod10 test to be a valid number(Like a Regular Expression test).  It won't
tell you if the number exist, but it will tell you if it could exist.  I
also know the mod10 is used for Canadian Social Security numbers (SIN).

Unfortunately I have never seen a PHP function for it, I only used mod10 in
a language called Uniface by Compuware.   I know there is another name for
it also, but I can't remember it right now.

It is a great test, someone just typing in numbers at random will have a
terrible time guessing a number right.  I have never seen someone do it let.
Then you can use the first character of the number to test the card type.

I will see if I can locate the algorithm and email it too you.


"Jas" <[EMAIL PROTECTED]> wrote in message
> Just wondering if anyone has come across the need to develop a class to
> a string of numbers based on a credit card type.  If you have where would
> be able to get information on what string of numbers is consistent with
> of the different credit cards?  Any help would be appreciated!
> Jas

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to