Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/7335-thousand-separator/
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...
Link to comment
https://forums.phpfreaks.com/topic/7335-thousand-separator/#findComment-27006
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
Link to comment
https://forums.phpfreaks.com/topic/7335-thousand-separator/#findComment-27409
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' :)
Link to comment
https://forums.phpfreaks.com/topic/7335-thousand-separator/#findComment-27418
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.