I am trying to write a math equation with PHP. The equation I need to write is:
(.0054 * 260000) / (1-1.0054^-360)
This equals: 1639.958570 (On my calculator)
With the script I am writing I have it as such:
$dec = .0054;
$amount = 260000;
$months = 360;
$equation = ($dec * $amount) / (1 - (1 + $dec)^-$months);
print $equation;
The answer I am getting when I do this is “-3.9”
Any idea what I’m doing wrong?
Try using the pow() function: