1

I'm trying to use money_format() to obviously add separators and a currency symbol to a number I have. I've seen plenty of examples where they work, but for some reason the currency symbol does not display.

$_price = '10995';    
setlocale(LC_MONETARY, 'en_GB.UTF-8');
echo money_format('%n', $_price);

results in:

10995.00

I can do this and it nearly works, however as I understand, that's not the point?:

echo money_format('£%n', $_price);

results in:

£10995.00

I can see that this also formats the number close to how I want, without the .00:

echo '£'.number_format( $_price );

results in:

£10,995
Jonathan Garrett
  • 115
  • 1
  • 1
  • 10
  • 1
    have you verified that you have locale files loaded/available - http://stackoverflow.com/a/10910009/689579 – Sean Apr 02 '15 at 16:05

1 Answers1

2

From Sean's link in the above comment, I can see that the locale for en_GB was not created.

once created with sudo locale-gen en_GB.UTF-8 I had the currency symbol

Jonathan Garrett
  • 115
  • 1
  • 1
  • 10