|
Posted by chotiwallah on 10/21/05 09:56
gayle wrote:
> Hello php group,
> 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.
> Gayle
straight from the manual:
echo round(1.95583, 2); // 1.96
micha
Navigation:
[Reply to this message]
|