I'm setting up an online shop and have heard that PHP supports basic credit card number verification (ie. mod-10, if the credit card number is valid). Has anyone used this before?
Anikin's code will check the luhn-10 checksum of a credit-card number presented. Use it.
I recommend you also perform other other checks, too, based on the type of card. For example, it is possible to input a supposed Visa number that passes luhn-10, but does not begin with a "4", as all Visa card numbers must.
Here's the guts of a switch statement I have used in my code before:
default :
break;
}[/tt] ______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.