Hi,
I have a the following tax table which shows tax calculations on wages. The way it works is that you find the row where your annual wage is between the lower and upper limits. Then the difference between your wage and the above column is multiplied by the rate. You then add the last column to your result.
Lower Upper Percent Above Also Add
0 2,650 0.0% 0 0
2,650 10,120 10.0% 2,650 0
10,120 33,520 15.0% 10,120 747.00
33,520 77,075 25.0% 33,520 4,257.00
77,075 162,800 28.0% 77,075 15,145.75
162,800 351,650 33.0% 162,800 39,148.75
351,650 and over 35.0% 351,650 101,469.25
Note: Lower limit = last upper limit;
above = last lower limit;
also add = (last upper - lower)*last percent.
Example: Say you earn 15,600 a year, you take:
(15,600-10,120) * .15 + 747 = 1,569
My question is, how can you do this in PHP given these arrays:
$LowerLimits = array(0,2650,10120,33520,77075,162800,351650); //must you have a 0?
$Percents = array(0,.10,.15,.25,.28,.33,.35);
Thank you