Skip to content

Instantly share code, notes, and snippets.

@AnrDaemon
Last active March 26, 2020 15:44
Show Gist options
  • Save AnrDaemon/f57b41f58ad0d71d59e251ff634b7486 to your computer and use it in GitHub Desktop.
Save AnrDaemon/f57b41f58ad0d71d59e251ff634b7486 to your computer and use it in GitHub Desktop.
<?php
$nf = new \NumberFormatter("ru_RU", \NumberFormatter::CURRENCY);
$cs = ini_get('default_charset');
$formatter = function($price, $currency = 'RUB')
use($nf, $cs)
{
return iconv('UTF-8', "$cs//IGNORE", $nf->formatCurrency($price, $currency));
};
print $formatter(1.1) . "\n";
print $formatter(2.3, "EUR") . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment