Skip to main content

PHP money_format(); £ sign not GBP


I cannot work out how to get the currency symbol?



At the moment I am using




setlocale(LC_MONETARY, 'en_GB');
money_format('%i', 1000);



Which give me the output




GBP1,000



But I want




£1,000



I have checked out the PHP manual but it isn't that helpful.



Any ideas?


Source: Tips4all

Comments

  1. Have you tried this?

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

    ReplyDelete
  2. An easy solution could be te replace GBP with & pound ; (without the spaces) after the money_format.

    ReplyDelete
  3. Use str_replace() function is an option.

    £ - British Pound - £ (163)

    // Search for the GBP in your string (subject) then replace for the symbol code
    $search = "GBP";
    $replace = "£";
    $subject = "GBP";
    echo str_replace($search, $replace, $subject);

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?