necesito hacer una suma de horas para ver cual fue la cantidad de tiempo trabajado, tengo una entrada digamos a las 7:00:00 y una salida a las 10:00:00 osea que serian 3 horas transcurridas trabajadas en el tiempo de la mañana y la persona ingresa de unevo a trabajar a las 1:00:00 y sale a las 5:00:00 osea que serian 5 horas de trabajo mas 3 anteriores serian 8, osea que la persona trabajo 8 horas este dia. aqui les dejo lo que he hecho 
   Código PHP:
   
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Problema</title>
</head>
<body>
 
<?php
 
 
include ("../Conexion/conexion.php");
 
 
if ($_POST)
 
    {
        $ficha=$_POST["nf"];
        $emple=$_POST["em"];
        $hi=$_POST["he"];
        $hs=$_POST["hs"];
        $hi2=$_POST["he2"];
        $hs2=$_POST["hs2"];
 
    }
 
 
function restaHoras($horaIni, $horaFin)
 
{ 
    return (date("H:i:s", strtotime("00:00:00") + strtotime($horaFin) - strtotime($horaIni) )); 
 
}
 
$total=restaHoras("$hi","$hs");
echo "<br>";
 
 
 
function restaHoras2($horaIni2, $horaFin2)
 
{ 
    return (date("H:i:s", strtotime("00:00:00") + strtotime($horaFin2) - strtotime($horaIni2) )); 
 
}
 
$total2=restaHoras2("hi2","$hs2");
echo "<br>";
 
/*
function sumarHoras ($valor1/*$valor2*//*)
/*
{
    return (date("H:i:s", strtotime("$total") /*- strtotime($valor2)*/ /*+ strtotime($valor1) ));*/
/*}*/
 
 
/*echo $suma=sumarHoras("$total2");*/
 
echo date('H:s:i', strtotime('$total+ $total2'));
 
//resultado: 17:00:00
 
 
 
 
 
$sql="insert into horas2 (Numero_Ficha,Empleado,entrada,salida,Entrada2,Salida2,total) values ('$ficha','$emple','$hi','$hs','$hi2','$hs2','$suma');";
 
 
$datos=mysqli_query($conexion,$sql);
 
 
 
?>
 
    <form action="" method="post">
        <table align="center" border="2">
            <tr>
                <td align="center">Calculo</td>
            </tr>
 
            <tr>
                <td>Número de ficha <input type="text" name="nf"></td>
            </tr>
 
            <tr>
                <td>Empleado<input type="text" name="em"></td>
            </tr>
 
            
            <tr>
                <td>Hora de entrada <input type="text" name="he"></td>
            </tr>
 
            <tr>
                <td>Hora salida <input type="text" name="hs"></td>
            </tr>
 
                <tr>
                <td>Hora de entrada #2<input type="text" name="he2"></td>
            </tr>
 
            <tr>
                <td>Hora salida #2<input type="text" name="hs2"></td>
            </tr>
 
 
            <tr>
                <td align="center"><input type="submit" value="Calcular"</td>
            </tr>
 
            
        </table>
 
    </form>
 
 
</body>
</html>