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?

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

5 Responses to PHP money_format(); £ sign not GBP

  1. Aidan says:

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

  2. Rado says:

    Not familiar with the benefits of money_format, but I would just use number_format instead and just prepend the currency symbol to it.

  3. Fernando says:

    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);
    
  4. B4NZ41 says:

    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);
    
  5. Anonymous says:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>