<?php
Yii::app()->numberFormatter->formatCurrency(1234.5678, 'USD'); // 1 234,57 $
Yii::app()->numberFormatter->formatCurrency(1234.5678, 'EUR'); // 1 234,57 €
Yii::app()->numberFormatter->formatCurrency(1234.5678, 'RUB'); // 1 234,57 руб.
It is easy do this with wrapper function:
<?php
function formatCurrency($value, $currency = "USD")
{
return Yii::app()->numberFormatter->formatCurrency($value, $currency);
}
formatCurrency(1234.5678, 'USD'); // 1 234,57 $
formatCurrency(1234.5678, 'EUR'); // 1 234,57 €
formatCurrency(1234.5678, 'RUB'); // 1 234,57 руб.