PHP money_format(); £ sign not GBP PHP money_format(); £ sign not GBP php php

PHP money_format(); £ sign not GBP


Have you tried this?

setlocale(LC_MONETARY, 'en_GB');utf8_encode(money_format('%n', 1000));


This worked for me:

setlocale(LC_MONETARY, 'en_GB.UTF-8');money_format('%n', 1000);

It's similar to the selected solution, however it didn't work for me. Why? The reason is that the locale en_GB was not defined in my system, only en_GB.UTF-8:

$ locale -a | grep "en_GB"en_GB.utf8

In addition, by using the UTF-8 codeset directly, the extra call to utf8_encode can be saved.


Here's a solution for those of you, like me, who think PHP's money_format is horrible.

$formatted = '£' . number_format( (float) $amount, 2, '.', ',' );