[text]41123531[/text]
How do I convert this result from a variable on-the-fly, into this:
[text]41,123,531[/text]
??
I don't know what you call the change to know how find it in php sites. I'm sure it's easy, but I don't have a clue. Thanks in advance.
Simple formatting issue
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Simple formatting issue
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Simple formatting issue
implode() can create that type of formatting but the original variable needs to been an array, the "glue" will then be used between each element.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Simple formatting issue
You're making hard work for yourself, there is already a function that does what he requires; number_format.social_experiment wrote:implode() can create that type of formatting but the original variable needs to been an array, the "glue" will then be used between each element.
Re: Simple formatting issue
To really give it to you for free:
Code: Select all
echo number_format(41123531,0,".",",")
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Simple formatting issue
luuuuvly. i knew there would be an inbuilt way.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.