Using Zend_Currency to display a value without using a symbol

1.1k Views Asked by At

I am outputting a value using toCurrency() from Zend:

echo $currency->toCurrency(1000, array('currency' => "GBP", 'precision' => 2));

Which gives me an example of £ 1,999.99, without using any extra code such as preg repplace can i return the value with NO symbol?

Complete code:

// $locale is set by browser
Zend_Registry::set('Zend_Locale', $locale);
$currency = new Zend_Currency();
echo $currency->toCurrency(1000, array('currency' => "GBP", 'precision' => 2));
// £1,000.00 but would like only 1,000.00

If anyone needs to know more information please do not hesitate to ask.

If anyone is curious as to what I am doing mashing two currencies together, I am displaying monetary values in a localised format but representing them in GBP. This is why I would prefer to avoid using a strip/replace method because I can not guarantee accuracy when representing values.

1

There are 1 best solutions below

2
On BEST ANSWER

You may specify the 'symbol' to display your currency with. This includes an empty string:

echo $currency->toCurrency(
    1000,
    array(
        'currency' => "GBP",
        'precision' => 2
        'symbol' => ''
    )
 );

Reference