PHP/MySQL: Best money operations/storing practices? PHP/MySQL: Best money operations/storing practices? mysql mysql

PHP/MySQL: Best money operations/storing practices?


I'd definitely go for using ints and routing everything through a data object (ORM) style that then handles all conversion for you. The client code using the data object will never need to do conversion and won't care, while you won't have problems with storage as ints are handled easily by the DB. Furthermore, you can then add whatever other methods are needed for the money object (like conversions between money types, etc) quite easily.


I also had trouble finding information about BCMath, so I researched it and wrote my own article about it: http://www.exploringbinary.com/base-conversion-in-php-using-bcmath/ .

(I'm not taking the stance that you should use BCMath -- I'm just giving you information.)