Calculation of arrays with time format by $ _POST in PHP

1

I have a dynamic form from which comes the name of the interrupt, start time and end time. It should return the interrupts and the added times, however, in the total field of lost hours, it has to subtract the term at the beginning and add with another interruption if it has. Example below:

Theproblemisthatitisshowingintotal,thefirstcalculation,andthesum.Codebelow:

$mostrar=0;$somah=0;$somam=0;for($i=0;$i<count($_POST['interrupcao']);$i++){$total=strtotime($_POST['terminoint'][$i])-strtotime($_POST['inicioint'][$i]);$horas=floor($total/60/60);$minutos=round(($total-($horas*60*60))/60);$somah+=$horas;$somam+=$minutos;$mostrar.=$somah.":".$somam;

   $html .="<tr>";
   $html .="<td>{$_POST['interrupcao'][$i]}</td>";
   $html .="<td>{$_POST['inicioint'][$i]}</td>";
   $html .="<td>{$_POST['terminoint'][$i]}</td>";
   $html .= "</tr>";
  }
    
asked by anonymous 13.11.2017 / 15:00

0 answers