You can compare the dates with PHP's DateTime
class:
$date = new DateTime($event['date']);
$now = new DateTime();
if($date < $now) {
echo 'date is in the past';
}
See it live!
Note: Using DateTime
class is preferred over strtotime()
since the latter will only work for dates before 2038. Read more about the Year_2038_problem.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…