Answers for "php validate credit card expiration date"

PHP
1

php check credit card expiration

$expires = DateTime::createFromFormat('my', $_POST['expMonth'].$_POST['expYear']);
$now     = new DateTime();

if ($expires < $now) {
    echo 'Expired!';
}
Posted by: Guest on August-13-2020
0

php validate credit card expiration date

$expires =  date_format( \DateTime::createFromFormat('ym', $cc_expiration),"ym");

$now =  date_format(new \DateTime(),"ym");

if ($expires < $now) {
    return 'Expired!';
}
Posted by: Guest on October-18-2020

Browse Popular Code Answers by Language