3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sumTimes($time1, $time2) { list($hours1, $minutes1) = explode(':', $time1); list($hours2, $minutes2) = explode(':', $time2); $totalHours = $hours1 + $hours2; $totalMinutes = $minutes1 + $minutes2; if($totalMinutes >= 60){ $hoursInMins = floor($totalMinutes/60); $totalHours += $hoursInMins; $totalMinutes -= ($hoursInMins * 60); } return "$totalHours:$totalMinutes"; } echo sumTimes('15:00:00', '18:30:00') . PHP_EOL;
based on 9Ko6v
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.2.0
33:30
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/4QDhv on line 16 33:30PHP_EOL