Validate All Major Credit Cards


Checking “$CreditCard[$i]”

"; if (ValidateVisaCreditCard($CreditCard[$i])) { $Card = 1; } else { if (ValidateAmericanExpressCard($CreditCard[$i])) { $Card = 2; } else { if (ValidateDiscoverCard($CreditCard[$i])) { $Card = 3; } else { if (ValidateDinersCard($CreditCard[$i])) { $Card = 4; } else { if (ValidateMasterCard($CreditCard[$i])) { $Card = 5; } else { $Card = 6; } } } } } switch($Card) { case 1: echo "

Your credit card number $CreditCard[$i] is a valid Visa Card.

"; break; case 2: echo "

Your credit card number $CreditCard[$i] is a valid American Express Card.

"; break; case 3: echo "

Your credit card number $CreditCard[$i] is a valid Discover Card.

"; break; case 4: echo "

Your credit card number $CreditCard[$i] is a valid Diners Card.

"; break; case 5: echo "

Your credit card number $CreditCard[$i] is a valid MasterCard.

"; break; case 6: echo "

The number you entered, $CreditCard[$i], is invalid for all major credit cards.

"; break; } } ?>