1
I have the following code on 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;
He returns to me what was the cost of the day 01/06 until 15/06, on a basis of 120.00 per 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
Someone knows how to do it?
very good thank you
– Hugo Borges