Converting EXCELL SUM into PHP

Hi All,

I have two excell sums that I'm trying to  replicate in PHP:

they are:

A.   =SUM(150000*(1+0.06)^25)        outputs = 643780.608

B.     =SUM(80000+(150000*0.09^25))*(1+0.06)^25           outputs  = 343349.6576


I've attempted [A] using the following:

$v1 = (150000*(1+0.06));
$v2 = pow($v1,25);

$v2 ouputs = 1.0837474984052E+130

Not sure where im going wrong so if someone could help me replicate those two SUM that would be great.




LVL 2
CurtinPropAsked:
Who is Participating?
 
Saqib Husain, SyedEngineerCommented:
Or simply

$v1 = 150000*pow(1+0.06,25);

in one step
0
 
Minh Võ CôngCommented:
$v1 = SUM(80000+(150000*0.09^25));
$v2 = $v1*pow((1+0.06),25);
0
 
ienaxxxCommented:
yeah, minhvc is right.
What you wrote in the first line differs much from what you reproduced in PHP...
:-)
0
 
CurtinPropAuthor Commented:

ssagibh's response was spot on and also was the basis for replicating the other SUM.

So SUM A. in PHP was:

150000*pow(1+0.06,25);

Based on that I converted B. to:

(80000+(150000*pow(0.09,25)))*pow(1+0.06,25)

Thanks very much for the help guys.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.