-2
I need to calculate the value of a service based on time. I managed to do this part, I will make the code available here. The problem is that I need to do the reverse, calculate the hours based on a value available to the user, for example:
The time of service costs: R$ 100,00. If I choose two hours of service the value will be calculated to R$ 200,00. OK, all right!
But how can I reverse this calculation? Type, the user has available as credit R $ 550,00, as I would calculate from this value the amount of X hours he has available for use?
Time-value calculation code:
<?php
$baseHora = 130.00;
$horas = "02:00:00";
$horas = explode(":", $horas);
$valor = $baseHora*$horas[0];
echo $valor;
?>