如何在PHP中检查日期是否过去


How to check if the date is in the past in PHP?

我的日期格式为:2016 年 1 月 21 日我想检查它是否在过去 PHP 中。我该怎么做?

使用 strtotime()

if(strtotime($date)<strtotime("today")){
    echo "past";
} elseif(strtotime($date)==strtotime("today")){
    echo "today";
} else {
    echo "future";
}