Is there a flag in the money_format function that lets you replace the long currency (e.g. USD, EUR) with the abbreviated version ($, €)?
Yes: the documentation specifies the "n" flag for the current locale's national currency format:
<?php
setlocale(LC_MONETARY, 'en_GB.UTF-8');
echo money_format('%n', 7.99); // £7.99
setlocale(LC_MONETARY, 'en_US.UTF-8');
echo money_format('%n', 7.99); // $7.99
Make sure you set a locale for LC_MONETARY (or LC_ALL, of course).
精彩评论