|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (11)
View Page History<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}
{zone-data:component-name}
{code}
// this converter will be used by default by all instances of Zend_Money
Zend_Money::setDefaultConverter('xe');
// we create a new object of class Zend_Money and it is automatically parsed from string
// in current Locale
$price = new Zend_Money('15.6 USD');
// we add new monetary value to the object
$price->add('19 EUR'); // instant conversion through specified webservice is done automatically
echo $price; // we get '35 USD'
$price->add('19 EUR');
// the object still has value in the same currency as it was created (USD)
// and we get something like this: '35.15 USD'
// format of the output is specified in Zend_Money defaults
echo $price;
// the object still has value in the same currency as it was created (USD)
// and we get something like this: '35.15 USD'
// format of the output is specified in Zend_Money defaults
echo $price;
{code}
||UC-02||
{code}
// we can easily manipulate with Zend_Money objects
$price = new Zend_Money('15 USD');
// for example, we can add one object to another
$price->add(new Zend_Money('500 GBP'));
// or we can do other math operations:
$price->divide(5);
// we can compare objects
$isIt = $price->greaterThan('$450');
{code}
{zone-data}
{zone-data}
{zone-template-instance}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>