How to Validate Credit Card Number in PHP

Credit Card Number Validation in PHP

Here a Simple PHP code to Validate Credit card Number. This credit card validate PHP script is mostly used in E-Commerce applications projects.

Credit Card Validation Regular Expression -REGEX


/^((4d{3})|(5[1-5]d{2})|(6011)|(7d{3}))-?d{4}-?d{4}-?d{4}|3[4,7]d{13}$/
You the below PHP code to validate the credit card Number.
function validate_creditcard($val)
{
return (bool)preg_match("/^((4d{3})|(5[1-5]d{2})|(6011)|(7d{3}))-?d{4}-?d{4}-?d{4}|3[4,7]d{13}$/",
$val);

}


Related Topic Credit Card Number Validation Java
Basic Validators in Struts Framework
How to Register a Domain Name
How to Change Paypal Account Password
A to Z Linux Commands quick reference sheet

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback