Today I got myself up with searching on Google and trying to understand the Zend Currency (a great way to easily format numbers in currencies format – PHP does have a function but it does not work under Windows) examples in the Zend Framework documentation. Whatever I did it was not working until I have bumped into a help manual from Zend that showed a better example.
Basically, the Zend Currency will totally bypass the parameters in the array and throw an error if the like the examples on the API documentation are set:
$currency = new Zend_Currency(‘value’ => 100,‘display’ => Zend_Currency::USE_SHORTNAME,));
print $currency; // Could return ‘USD 100’
$currency = new Zend_Currency();echo $currency->toCurrency(100); // could return USD 100
$currency = new Zend_Currency(‘en_US’, ‘EUR’); // set locale to USA and the currency format to Euroecho $currency->toCurrency(100);
$currency = new Zend_Currency(array(‘locale’ => ‘en_US’, ‘value’ => 100, ‘currency’ => ‘EUR’);echo $currency; // doesn’t work unless you set the locale using the Zend_Registry and Zend_Locale