How to validate the credit card using php funtion

| Last Updated: | In: Core php, Freebies


In this article i have explain How to validate the credit card using php this funtion This function will validate a credit card is valid or not.

Bellow is the list of rules for top six most popular credit cards :

  • mastercard: Must have a prefix of 51 to 55, and must be 16 digits in length.
  • Visa: Must have a prefix of 4, and must be either 13 or 16 digits in length.
  • American Express: Must have a prefix of 34 or 37, and must be 15 digits in length.
  • Diners Club: Must have a prefix of 300 to 305, 36, or 38, and must be 14 digits in length.
  • Diners Club: Must have a prefix of 300 to 305, 36, or 38, and must be 14 digits in length.
  • Discover: Must have a prefix of 6011, and must be 16 digits in length.
  • JCB: Must have a prefix of 3, 1800, or 2131, and must be either 15 or 16 digits in length.

cccard-validation_php

PHP Function

Download      Demo

You can use this libraryfunction to validate the credit card. This is free for Demo and code download. Please see the demo first and if you like it then download it.

I hope you like this simple and easy PHP function if yes then please feel free to comment below.

Tags: , ,


About: Prem Tiwari

Prem Tiwari is founder of freewebmentor.com and Software developer from New Delhi (India). Follow Prem's development codes on facebook, and make sure you check out freewebmentor.com for the latest in web development related Tips with the complete code.


You may also like:

Follow us!

Get Free Access of 350+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW