So I'm trying to get the difference in days for the following dates. For one of them it works, but for the other the number is off. It should be 3.
I could use the ceil function, but I still don't know why the following isn't correct.
$checkOut = strtotime('2011-02-16');
$checkIn = strtotime('2011-02-11');
echo ($checkOut - $checkIn) / (60 * 60 * 24); // => 5
echo floor(($checkOut - $checkIn)/(60*60*24)); // => 5
$checkOut = strtotime('2011-03-14');
$checkIn = strtotime('2011-03-11');
echo ($checkOut - $checkIn) / (60 * 60 * 24); // => 2.958333333
echo floor(($checkOut - $checkIn)/(60*60*24)); // => 2
strtotimereturns seconds since epoch, but I guess that is not the case.