CodeIgniter Credit Card Helper

Jim O’Halloran has put together a stellar Credit Card Helper for CodeIgniter which includes the following highly useful functions:

  • Card Number Truncation – Removes all but the first four and last three digits of a credit card and replaces them with X’s.
  • Card Number Cleaning – Removes all non-numeric characters from the credit card number (spaces, dashes, etc.)
  • Card Number Validation – Uses the Luhn algorithm to execute basic validation of a credit card number.
  • Card Expiry Date – Tests if the card is still active based on its expiration date.

I’ll definitely be putting this into my future ecommerce and online sales projects.

Want more articles like this one in your Inbox? Subscribe