954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

financial calculator output problem

Good Morning,
I finally made a php calculator program which combines compound interest and added fees, The only problem is when I use the the round() function if the fee ends in a zero it does not show the zero. example echo round($var,2);?> if $var equals let's say 3.001 the out put will only be 3, if $var equals 7.3000 the output would be 7.3.
what I would like is the output to be rounded to the next cent example if $var equals 3.001 the the output would be 3.00.
Is their a way to accomplish this? I'm sure I could change all the numerals back a hundreth and then multiply $var by .10, but I think the output would be the same.
Well if anyone has a suggestion I would greatly appreciate it. Thanks

Dsiembab
Junior Poster
156 posts since Mar 2007
Reputation Points: 18
Solved Threads: 2
 

*Opens new browser window*
*Loads php.net*
*Enters "cents" in the search box, and selects "Online Documentation" from the drop down.*
*Searches*
*Finds link to article about variable precision math*
*Posts link*

Perhaps this would be of some use?
http://www.php.net/manual/en/ref.bc.php

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
 
*Opens new browser window* *Loads php.net* *Enters "cents" in the search box, and selects "Online Documentation" from the drop down.* *Searches* *Finds link to article about variable precision math* *Posts link* Perhaps this would be of some use? http://www.php.net/manual/en/ref.bc.php


*Clicks Link*
*Searches*
*Finds Link http://www.php.net/manual/en/function.bcadd.php *
*Fixes PHP Code*
*Thanks Puckdropper*
thanks appreciate it
*Starts Working On HTML Design for PHP Code*

Dsiembab
Junior Poster
156 posts since Mar 2007
Reputation Points: 18
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You