我想设置我的输出为“日期未确认”,如果从MySQL的日期= 2013-12-25 & $ daydiff =“任何”,并输出“不可用”如果MySQL date =“NULL”& and $ daydiff =“anything”日期范围到PHP在几个月
我的代码似乎不工作,任何建议或替代?
$ArrivalDate == $variants_data['ArrivalDate'];
$daydiff=floor((abs(strtotime(date("Y-m-d")) - strtotime($ArrivalDate))/(60*60*24)));
if ($daydiff == '%wildcard%' && $ArrivalDate == '2013-12-25') {
$ETA ='Date Not Confirmed';
}
elseif ($daydiff == '%wildcard%' && $ArrivalDate == 'NULL') {
$ETA ='Not available';
}
elseif ($daydiff > 30 && $daydiff < 60) { // anything between 31 and 59 days is 1 month
$ETA ='1 Month';
}
elseif ($daydiff > 60 && $daydiff < 90 ) { // anything between 61 and 89 days is 2 months
$ETA ='2 Months';
}
else
{
$ETA ='';
}
你想用'%wildcard%'做什么? – 2013-04-10 09:35:15
这是为了任何价值。 – Mlungisi 2013-04-10 09:54:08
那么为什么把它放在if里,如果有价值的话呢?是0还可以接受吗? – 2013-04-10 10:08:35