将公式转换为PHP会产生错误的输出

I have the following formula

-32.16874499 = (0-0.02*1000)*(1+0.02)^24

When I create this formula in PHP it an echo of the paramters looks like:

(0-0.02*1000)*(1+0.02),24

This is just an echo of the PHP code:

$goalMonthly = pow((($J-$mIntrest*$T)*(1+$mIntrest)),$months);

$goalMonthly hold the value: 26.985.099.156.891.700.138.339.884.597.248

I would expect a value like -32.16

According to how your formula is written it looks like you should have it like:

   $goalMonthly = ($J-$mIntrest*$T) * 
      pow((1+$mIntrest),$months);

You were using pow on the whole expression.

It should be:

$goalMonthly = ($J-$mIntrest*$T)*pow((1+$mIntrest),$months);