PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

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.

<?php
$currency 
= new Zend_Currency(
    array(
        
'value'    => 1000,
        
'currency' => 'USD',
    )
);

print 
$currency// Could return '$ 1.000'

Using the setFormat() method with this array option, and also by using the setValue() method you can set the value afterwards.

<?php
$currency 
= new Zend_Currency(
    array(
        
'value'    => 1000,
        
'currency' => 'USD',
    )
);

print 
$currency->setValue(2000); // Could return '$ 2.000'

With the getValue() method you will get the actual set value.

Zend Framework