I have got a calculation written in php, its meant to calculate the total balance (echo $vf;) after 3 months.
The answer I get is 603.00
The answer I should get is 606.02
Somewhere I have gone wrong that it is losing 3 the math, any idea ?
I have been working on this for weeks and am so close, any help will be very much appreciated.
Code
$p = 0;
$i = 0.06;
$c = 12;
$n = 3/12;
$r = 200;
$x = $i / $c;
$y = pow((1 + $x), ($n * $c));
$vf = $p * $y + ($r * ($y - 1) / $x);
echo $vf;
Sand box if needed https://3v4l.org/FigRr
Thanks
UPDATE
have been informed my math may be wrong, here is the original formula bellow, can anyone see how I have written the php wrong ?
UPDATE
What I am after is to get the compound of 200 after 3 months, when I have used online calculators I get 606. for example http://www.thecalculatorsite.com/finance/calculators/compoundinterestcalculator.php
Update have tried:
$i = 0.06;
$c = 12;
$n = 3;
$r = 200;
$x = $i / $c;
$z = $n / 12;
$y = pow((1 + $x), ($z * $c));
$vf = $y + ($r * ($y - 1) / $x);
echo $vf;
has improved the answer and am getting 604, but still not getting the 606