You are here: Re: Currency stored as cents « PHP « IT news, forums, messages
Re: Currency stored as cents

Posted by Jasper Bryant-Greene on 07/03/05 03:02

Satyam wrote:
> I would rather use native data types and functions. This is a good idea
> when you have to deal with the balance sheet of a corporation, where you
> have to handle huge numbers and still be precise up to the last cent. For
> most retail business, where the largest amount can still be expressed in
> cents within the range of a 32 bit integer, the bcmath package is like
> overkill.

Please don't top-post. You make a fair point though. Have you looked at
the "precision" configuration directive [1]?

In my applications I just let PHP store as many significant digits as it
likes during processing, and use number_format() whenever displaying to
limit it to 2 decimal places. That, coupled with storing them as
decimals with 2 decimal places in my MySQL databases, achieves
everything I need.

Jasper

 

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

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