Instead of calculating the timestamps from the two dates received as parameters, you could just receive those timestamps as parameters directly ; ie, just remove the calls to strtotime.
Something like this should do the trick, I suppose :
function dateDiffTs($start_ts, $end_ts) {
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
Afterall, strotime gets you the timestamp corresponding to a date ;-)
For instance, this :
var_dump(dateDiffTs(1251151200, 1251410400));
get you 3 days (1251151200 is 2009-08-25, and 1251410400 is 2009-08-28).
And this works if you have hours in the timestamps too :
var_dump(dateDiffTs(1251196200, 1251443700));
Gets you 3 days too (1251196200 is 2009-08-25 12:30:00 and 1251443700 is 2009-08-28 09:15:00).