I am using the following sample code to calculate sum of two different time values. Now I want to get the sum of N number of time values.
// numbers for testing
$o="12:59";
$p="0:58";
// display for testing
echo "$o<br />";
echo "$p<br />";
echo AddPlayTime($o,$p);
// FUNCTION - ADD HOURS and MINUTES
function AddPlayTime ($oldPlayTime, $PlayTimeToAdd) {
$old=explode(":",$oldPlayTime);
$play=explode(":",$PlayTimeToAdd);
$hours=$old[0]+$play[0];
$minutes=$old[1]+$play[1];
if($minutes > 59){
$minutes=$minutes-60;
$hours++;
}
if($minutes < 10){
$minutes = "0".$minutes;
}
if($minutes == 0){
$minutes = "00";
}
$sum=$hours.":".$minutes;
return $sum;
}