3v4l.org - online PHP & HHVM shell, execute code in 100+ different versions!

<?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('12:54', '100:06') . PHP_EOL; echo sumTimes('12:54', '100:20') . PHP_EOL;
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.0, php7@20140507 - 20140901, hhvm-3.0.1 - 3.2.0
113:0 113:14
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/9Ko6v on line 16 113:0PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9Ko6v on line 17 113:14PHP_EOL