I am using PHP to get the average amount per year. A simple example would be 5 years and a total of $100,000 would be $20,000 per year such as
$total = 100000;
$years = 5;
$yearly_average = ($total / $years);
My easy example above only uses 5 years. But my actual results have 5 years and 10 months for example. So would I subtract 10 months from 12 months (1 year), and use 5.2 to get an accurate average? So 5 years and 10 months would be 5.2 in numerical format?
$total = 100000;
$years = 5.2;
$yearly_average = ($total / $years);
Or maybe there is a better calculation? I want to make sure I am doing it correctly subtracting the number of months from 12 months. I searched on Stackoverflow and the similar questions used mysql queries so mine is a little different. Thanks.
4