You are here: Re: Setting the decimal point in php « PHP Programming Language « IT news, forums, messages
Re: Setting the decimal point in php

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация