Jump to content

Exploding a string & adding commas.


Cruisecar

Recommended Posts

Hey,

Firstly thank you for reading this, my problem is a very simple one, yet it seems to be very hard for me to achieve the needed result.

Basicly, I have a string ($money) pulled from a database, it could be any value from 0 or more. I need to add commas into that string every 3 numbers - it must be added from the end to the begining.

$money = "1000000"

After going through the function it should be "1,000,000". I tried using explode, and attempted using a wildcard - but there is none, also it would make the number "100,000,0".

I hope someone can help me! And once again, thankyou for reading.
Link to comment
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.