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);
}