所以我试图得到以下日期的天数差异。其中一个有效,但另一个数字已关闭。应该是3。
我可以使用该ceil
功能,但我仍然不知道为什么以下内容不正确。
$checkOut = strtotime('2011-02-16'); $checkIn = strtotime('2011-02-11'); 回声 ($checkOut - $checkIn) / (60 * 60 * 24); // => 5 echo floor(($checkOut - $checkIn)/(60*60*24)); // => 5 $checkOut = strtotime('2011-03-14'); $checkIn = strtotime('2011-03-11'); 回声 ($checkOut - $checkIn) / (60 * 60 * 24); // => 2.958333333 echo floor(($checkOut - $checkIn)/(60*60*24)); // => 2