I have the following code in PHP
:
$valor = 120;
$data_inicio = '2016-06-15';
$total_dias = date('t', strtotime($data_inicio));
$used = date('d', strtotime($data_inicio));
$result = ($valor/$total_dias)*$used;
echo $result;
It returns me what was the amount spent for the day 01/06 by 15/06 , with a basis of 120,00 by month.
I wanted to know how to do this with 2 different dates.
Example:
$data1 = '2016-06-16';
$data2 = '2016-07-01';
The result has to be 56.00
Does anyone know how to do this?