- floor: documentation ( source)
<?php
function calcDays($startdate, $enddate) {
$first = $startdate < $enddate ? $startdate : $enddate;
$second = $startdate < $enddate ? $enddate : $startdate;
$inbetween = $second - $first;
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
$week = $day * 7;
$days = floor($inbetween / 60 / 60 / 24);
$hours = floor($inbetween / 60 / 60 - $days * $day / $hour);
$minutes = floor($inbetween / 60);
return $days . " " . $hours . " " . $minutes;
}
echo calcDays(1388386746, 1388390426);