Re: Currency stored as cents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux