Programmer's Reference Guide
| How does the currency look like? |
How much is my currency?
When you are working with currencies then you normally want to display an amount of money. And when you work with different currencies then you have to do this with three different things. The amount you want to display, the precision you want to use, and probably the exchange rate.
Working with currency values
The currency value, a.k.a. the money, you want to use can easily be set by using the value option.
Using the setFormat() method with this array option, and also by using the setValue() method you can set the value afterwards.
With the getValue() method you will get the actual set value.
Using precision on currencies
When working with currencies they you probably also have to handle precision. Most currencies use a precision of 2. This means that when you have 100 US dollars you could also have 50 cents. The related value is simply a floating value.
Of course, as the default precision is 2, you will get '00' for the decimal value when there is no precision to display.
To get rid of this default precision you could simply use the precision option and set it to '0'. And you can set any other precision you want to use between 0 and 9. All values will be rounded or streched when they don't fit the set precision.
| How does the currency look like? |
Select a Version
Languages Available
Components
Search the Manual
Navigation
- Programmer's Reference Guide
- Programmer's Reference Guide
- Zend Framework Reference
- Zend_Currency
- Introduction to Zend_Currency
- Using Zend_Currency
- Options for currencies
- What makes a currency?
- Where is the currency?
- How does the currency look like?
- How much is my currency?
- Calculating with currencies
- Exchanging currencies
- Additional informations on Zend_Currency
