I am having a strange result with PHP Version 5.3.1, can anyone explain the below result?
$secondsDiff = strtotime(date("2011-11-10")) - strtotime('2011-07-15');
return ($secondsDiff/86400);
it returns 117.958333333??
When I use dates closer together it generally works.
I had a look through the docs, but couldnt find any reference to this. Is this a known php bug that I just need to learn to live with or am I missing something very obvious?
This is probably due to a DST switch, which will increase or decrease the length of the period by an hour.
This could be fixed by rounding, or – more elegantly – by PHP 5.3’s fancy new DateInterval class which can format periods as days and more.
Stolen from the manual: