Although the other answers are right, they are not adding up the seconds. So I decided to create an alternative.
I made this response based on in this answer and this answer
$tempo_inicial= "18:59:59";
$tempo_somado= "07:00:01";
sscanf($tempo_inicial, "%d:%d:%d", $horas_inicial, $minutos_inicial, $segundos_inicial);
sscanf($tempo_somado, "%d:%d:%d", $horas_somado, $minutos_somado, $segundos_somado);
$tempo_segundos_inicial = $horas_inicial * 3600 + $minutos_inicial * 60 + (isset($segundos_inicial) ? $segundos_inicial : 0);
$tempo_segundos_somado = $horas_somado * 3600 + $minutos_somado * 60 + (isset($segundos_somado) ? $segundos_somado : 0);
$total = $tempo_segundos_inicial + $tempo_segundos_somado;
$horas = floor($total / 3600);
$minutos = floor(($total - ($horas * 3600)) / 60);
$segundos = floor($total % 60);
$temposomado = sprintf('%02d:%02d:%02d', $horas, $minutos, $segundos);
echo $temposomado; // saída será 26:00:00
See working at ideone
So, my version of the function AddPlayTime
of the @ WictorChaves response based on the example above would look like this:
$times = array();
$times[] = "18:59:59";
$times[] = "07:00";
$times[] = "00:00:01";
echo AddPlayTime2($times);
function AddPlayTime2($times) {
$total = 0;
foreach ($times as $time) {
if(substr_count($time, ":") == 1)
$time .= ":00";
sscanf($time, "%02d:%02d:%02d", $hour, $minute, $second);
$total += $hour * 3600 + $minute * 60 + $second;
}
$horas = floor($total / 3600);
$minutos = floor(($total - ($horas * 3600)) / 60);
$segundos = floor($total % 60);
return sprintf('%02d:%02d:%02d', $horas, $minutos, $segundos);
}