Let\'s start with simple piece of code to format money with NumberFormatter:
$formatter = new NumberFormatter(\'en_US\', NumberFormatter::CURREN
Cryptic has a good answer, but there is a simpler way to do it:
preg_replace('#[a-z0-9.]*#i', '', $formatter->formatCurrency('0', $currency))
This is a nice simple inline solution that doesn't require declaring another function, however it also doesn't properly handle all cases - i.e. currencies where letters are part of the output. But for distinguishing between e.g. $ and £, it works fine.