Jump to content

Archived

This topic is now archived and is closed to further replies.

AndieB

Thousand separator

Recommended Posts

Hi all!


If I have a variable, lets call it $number, and it contains the number 21500.
Is there a function which can performe a thousand separator function, so the displayed result will
be 21 500?

And even at next level, million separator?

Thankful for anykind of help!

--Andreas

Share this post


Link to post
Share on other sites
[a href=\"http://ca3.php.net/manual/en/function.number-format.php\" target=\"_blank\"]number format function[/a]

Share this post


Link to post
Share on other sites
Can this be used on the [i][b]decimal(6,2)[/b][/i] data type?

Share this post


Link to post
Share on other sites
[code]$n = 12345.67;

echo number_format ($n, 2);[/code]

--> 12,345.67

Share this post


Link to post
Share on other sites
[!--quoteo(post=364618:date=Apr 13 2006, 05:52 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 13 2006, 05:52 PM) [snapback]364618[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]$n = 12345.67;

echo number_format ($n, 2);[/code]

--> 12,345.67
[/quote]Thanks...

Share this post


Link to post
Share on other sites
Follow-Up question:


In Sweden we tend to use the , (comma) as a separator for decimals. I've noticed that PHP will not accept me doing a calculation using the comman (,) sign. (ie 30000 * 1,25), I must do this (30000 * 1.25).

Is this something one can change or do I have to live with it?


Thanks 4 any kind of help!

--Andreas

Share this post


Link to post
Share on other sites
[!--quoteo(post=365241:date=Apr 16 2006, 08:34 AM:name=AndieB)--][div class=\'quotetop\']QUOTE(AndieB @ Apr 16 2006, 08:34 AM) [snapback]365241[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Follow-Up question:
In Sweden we tend to use the , (comma) as a separator for decimals. I've noticed that PHP will not accept me doing a calculation using the comman (,) sign. (ie 30000 * 1,25), I must do this (30000 * 1.25).

Is this something one can change or do I have to live with it?
Thanks 4 any kind of help!

--Andreas
[/quote]

as far as i know, you have to live with it, just like all us non-americans have to get used to spelling the word 'colour' without the 'u' :)

Share this post


Link to post
Share on other sites
Have a look at [a href=\"http://www.php.net/setlocale\" target=\"_blank\"]http://www.php.net/setlocale[/a]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.