3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $minute = 60; $hour = $minute * 60; $day = $hours * 24; $days = floor($inbetween / $day); $hours = floor($inbetween / $hour - $days * $day); $minutes = floor($inbetween / $minute - $hours * $day - $days * $hour); return $days . " " . $hours . " " . $minutes; } echo calcDays(1388385927, 1488390027);
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: hours in /in/HVNtC on line 10 Warning: Division by zero in /in/HVNtC on line 12 INF NAN NAN
Output for 5.0.4 - 5.6.28
Notice: Undefined variable: hours in /in/HVNtC on line 10 Warning: Division by zero in /in/HVNtC on line 12 0 27778 1666735
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: hours in /in/HVNtC on line 10 Warning: Division by zero in /in/HVNtC on line 12 0 27778 1666735