Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Setting the decimal point in php
October 21, 2005, 4:51 am
rate this thread
I have just joined. My usual group is sitemaps and a dozen other
forums, but nobody seems to be able to come up with exactly the advice
I am after. I just know there has to be a simple answer. I have a
script that calculates everything nicely and feeds the data into my
database after first showing the result on the screen etc etc. All
works nicely except that it calculates everything to the finest decimal
place. What I don't know is how to command it to round the decimal
places to two. I've tried a number of things, taken a number of
suggestions; but I won't mention them here as they might confuse the
issue. The main thing is that I need to tell the script to operate on
an unknown number with the function of rounding to two places. Let's
say the result is $totalname; can anybody suggest how to command that
$totalname has only 2 decimal places?
Thanks for listening.
- » How to create a string that has new lines and tab characters in it?
- — Previous thread in » PHP Scripting Forum