3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $days = floor($inbetween / 60 / 60 / 24); $hours = floor($inbetween / 60 / 60 - $days * 24); $minutes = floor($inbetween / 60 - $hours * 60 - $days * 24); return $days . " " . $hours . " " . $minutes; } echo calcDays(1388385927, 1488390027);

preferences:
52.53 ms | 402 KiB | 5 Q