title: How to sum N number of time (HH:MM Format)?
body: <p>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.</p>
  
  <pre><code>// numbers for testing
  $o="12:59";
  $p="0:58";
  
  // display for testing
  echo "$o&lt;br /&gt;";
  echo "$p&lt;br /&gt;";
  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 &gt; 59){
      $minutes=$minutes-60;
      $hours++;
    }
  
    if($minutes &lt; 10){
      $minutes = "0".$minutes;
    }
  
    if($minutes == 0){
      $minutes = "00";
    }
  
    $sum=$hours.":".$minutes;
    return $sum;
  }
  </code></pre>