- Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- 22 hours 0 minutes
<?php
$time = "18 hours 13 minutes";
$time2 = "47 minutes";
$time3 = "1 hour";
$time4 = "1 hour";
$time5 = "1 hour";
$time6 = "";
$time7 = "";
$start = new DateTime();
$end = clone($start);
if (!empty($time)) $end->modify("+$time");
if (!empty($time2)) $end->modify("+$time2");
if (!empty($time3)) $end->modify("+$time3");
if (!empty($time4)) $end->modify("+$time4");
if (!empty($time5)) $end->modify("+$time5");
if (!empty($time6)) $end->modify("+$time6");
if (!empty($time7)) $end->modify("+$time7");
$total = $end->diff($start);
echo $total->format('%h hours %i minutes');