How to display a shortened currency symbol instead of a currency name when using money_format ()?

Is there a flag in the money_format function that allows you to replace a long currency (for example, USD, EUR) with a shortened version ($, €)?

+4
source share
1 answer

Yes: the documentation indicates the ā€œnā€ flag for the national currency format in national currency:

<?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 the locale for LC_MONETARY (or LC_ALL, of course).

+5
source

All Articles