I have a math code that is giving to me the wrong answer, I check already the order of my code but I cannot see the problem, there is my code
$loan = $_POST[‘t_loan’];
$rate = $_POST[‘rate’];
$monts = $_POST[‘months’];
$f_rate = $rate/100;
$payment = ($loan * ($f_rate / 12)) * (pow((1 + ($f_rate / 12)), $monts) / ((pow((1 + ($f_rate / 12)), $monts)) + 1));
$payment = round($payment);
Print “$payment”;
there is the equation
With a Loan of 18000 rate of 4.9(0.049) and 60 months to pay the result should be a 338 monthly payment but I am getting 41
I really appreciate any help