Search code examples
mysqlzend-frameworkcurrencyzend-currency

How to store & process currencies in mysql / zend framework


We want to store product prices and weight (kg/pound) in MySQL. Can somebody tell me what's the best way to do this?

double/decimal/... ?

We need to be able to display both USD and EURos. I don't know if it helps, but we use the Zend framework to build our application.


Solution

  • Have you looked at the Zend_Currency family of functions?

    This component works with all available locales and therefore knows about more than 100 different localized currencies. This includes informations like currency names, abbreviations, money signs and much more.

    Zend_Currency has the advantage that already defined currency representations can be reused. You could also have 2 different representations for the same currency.

    Zend_Currency allows you also to calculate with currency values. Therefore, it provides you an interface to exchange services.

    If you like that part of the Zend Framework, I guess a lot of decisions will "sort themselves out" based on what they use to work with the values.