$expires = date_format( DateTime::createFromFormat('ym', $cc_expiration),"ym"); $now = date_format(new DateTime(),"ym"); if ($expires < $now) { return 'Expired!'; }