循环执行,将值转换为日期,然后将最新的值存储在var中。
$mostRecent= 0;
foreach($dates as $date){
$curDate = strtotime($date);
if ($curDate > $mostRecent) {
$mostRecent = $curDate;
}
}
诸如此类的东西…您就知道了如果您想获得今天之前的最新信息:
$mostRecent= 0;
$Now = time();
foreach($dates as $date){
$curDate = strtotime($date);
if ($curDate > $mostRecent && $curDate < $Now) {
$mostRecent = $curDate;
}
}