我在计算机和hostgator服务器上使用相同的代码。这是代码:
<?php
$checkout = "2014/03/11";
$checkin = "2014/03/09";
$checkin = date('Y/m/d', strtotime($checkin));
$checkout = date('Y/m/d', strtotime($checkout));
echo $checkin."<br />";
echo $checkout."<br />";
$nights = (strtotime($checkout) - strtotime($checkin)) / (60 * 60 * 24);
echo $nights;
?>
但是我得到了不同的结果。在我的计算机上显示正确的答案,即“2”。但在我的服务器上显示“1.95833333333”。
谁能告诉我什么是错的?
更新
以下是上述代码的输出:
2014/03/09
2014/03/11
1.95833333333