Credit Card Expiration Date Validation Script

Credit Card Expiration Date Validation Script is use to check a credit card number expiration date through regular expression.

Demo :



Validate Credit Card Number :    

Example :

Just type a credit card valid number like this 12/2017 and click Check button Is a valid date to credit card message will display otherwise type a 12/1999 text at textbox and click check button Is an invalid date to credit card will display here.

Code :

Following code is use to Credit Card Expiration Date Validation Script if you need to copy and use to your website.


<?php
  function validateCCExpDate($str)
  {
     return preg_match("/(0[1-9]|1[0-2])\/20[0-9]{2}$/", $str);
  }
   $ExpDate = "12/2013";
   echo validateCCExpDate($ExpDate) ? "Is a valid date string" : "Is an invalid date string";
?>

In the above $ExpDate variable is use to assign the Validate Credit Card Expiration Date. In the validateCCExpDate() function is use to check the validate credit card number expiration date through regular expression.

Free Download Script :

If you need Credit Card Expiration Date Validation Script click and download from following link.

Download




Content