Fatal error: Class 'Zend_Currency' not found

662 Views Asked by At

I am new to Zend.

Now, I am trying to print/format numbers as per my locale, however when I do this

$c = new Zend_Currency();
$c->setFormat(array('display' => Zend_Currency::NO_SYMBOL));
echo $c->toCurrency(2500.01);

returns error.

I have checked this:

ZEND currency symbol is displaying 1

Please help me on this.

2

There are 2 best solutions below

1
On BEST ANSWER

Most probably you are facing this issue because Zend library (Zend_Currency class) is not loading on page.

0
On

You can use the below class

use Magento\Framework\Currency\Data\Currency as CurrencyData

$price = (float) $currencyObj->format($price, ['display' => CurrencyData::NO_SYMBOL], false);