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?

Incoming search terms:

  • php money_format
  • regex british pound sign
  • php money_format uk pounds
  • php money_format gbp
  • php money_format â£
  • ⣠php money_format
  • php gbp symbol in regex
  • money_format € sign
  • money_format €
  • la signe pound dans php

Related posts:

  1. If dealing with money in a float is bad, then why does money_format() do it? I’ve been waffling on how to deal with currency display and math in PHP, and...
  2. How to output abbreviated currency symbol instead of currency name when using money_format()? Is there a flag in the money_format function that lets you replace the long currency...
  3. What does the & sign mean in PHP? I was trying to find this answer on Google but I guess the symbol &...
  4. Advice on a Canadian SMS Gateway provider I am curious as how to how much trouble / money it would be for...
  5. Rupee symbol in mail I am using PHP mailer to send mails to my clients. I need to insert...
  6. How to solve €25.99 vs 25,99€ preg_match problem? If I have these strings: $string1 = "This book costs €25.99 in our shop." and...
  7. Why does PHP have a $ sign in front of variables? In PHP and some other scripting languages have the $var syntax while Java and other...
  8. Letting users try your web app before sign-up: sessions or temp db? I’ve seen a few instances now where web applications are letting try them out without...
  9. Best way to implement Single-Sign-On with all major providers? I already did a lot of research on this topic and have implemented a lot...
  10. Regex failing when pattern involves dollar sign ($) I’m running into a bit of an issue when it comes to matching subpatterns that...

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

4 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);
    

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>