I make a query to the Database where it brings me a certain initial numbers and some endings that are saved in the arrays $ initial and $ final. I go through these arrays with a while but I want that every time the array is traversed, the initial $ value is saved in a temporary variable "$ temp" in order to make a sum between the value of the previous path of the "$ temp" and the current value of the final $ array, but I still do not know how to save the previous value of an array in a variable.
$resultado = $temp + $final;
my code in which I do the procedure is the following but it is necessary to implement the line of the sum of the variables
<?php
$consultaS = $conexion->query("SELECT * FROM generador2.'TALONARIO' WHERE 'inicial' > 1800000");
while ($filaS = $consultaS->fetch_array()) {
$inicial=$filaS['inicial'];
$final=$filaS['final'];
//$resultado= $inicial + $final;
echo "<tbody id='tbody' class='tbody'><tr><td name='elemento[]'><font size=2>" . $inicial . "</font></td>" . "<td><font size=2>" . $final . "</font></td>" . "<td><font size=2>" . $filaS['usuarioasigna'] . "</font></td>" . "<td><font size=2>" . $filaS['fechaasigna'] . "</font></td>". "<td><font size=2>" . $filaS['cedula'] . "</font></td>". "<td><font size=2>" . $filaS['estado'] . "</font></td>". "<td><font size=2>" . $filaS['recibido'] . "</font></td>". "<td><font size=2>" . $filaS['fecha_rec'] . "</font></td>". "<td><font size=2>" . $filaS['usuario_rec'] . "</font></td>" . "</tr>";
}
?>