A little help with my script would we appreciated. - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21) +---- Thread: A little help with my script would we appreciated. (/showthread.php?tid=876) |
A little help with my script would we appreciated. - Tasemu - 10-09-2009 Hey im making a script that calculates compound interest and everything should be working fine but when i run the script the answer is incorrect, i know the math is not wrong. Possibly the $I is automatically rounding off to a whole number (it is usually a decimal). Anyway any help or tips would be appreciated. Code: <?php Peace, iPhish. RE: A little help with my script would we appreciated. - Legion - 10-09-2009 The following links should provide you with a solution to your problem. http://se2.php.net/manual/en/language.types.integer.php http://se2.php.net/manual/en/function.round.php Next to that rounding can also be done in this way (example taken from "Recipes a problem solution approach") PHP Code: <?php Using the function round (taken from:"http://php.about.com/od/learnphp/ss/round_num_PHP.htm"). PHP Code: echo round(3.14159265, 3); Please reply in this topic if this reply did not help you. |