3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function add($first, $second) { $firstParsed = date_parse($first); $secondParsed = date_parse($second); $firstTotalMinutes = $firstParsed['hour'] * 60 + $firstParsed['minute']; $secondTotalMinutes = $secondParsed['hour'] * 60 + $secondParsed['minute']; $totalMinutes = $firstTotalMinutes + $secondTotalMinutes; $hours = (int)($totalMinutes / 60); $minutes = $totalMinutes % 60; return sprintf('%02d:%02d', $hours, $minutes); } echo add('01:30', '05:30');
Output for 5.5.0 - 7.3.0beta1
07:00