Displaying commas

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ace2600
Forum Commoner
Posts: 30
Joined: Fri Jun 21, 2002 12:12 am

Displaying commas

Post by ace2600 »

Is it possible to display commas when echoing a integer? Ex: 1234 would be displayed as 1,234
-Ace
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

ace2600
Forum Commoner
Posts: 30
Joined: Fri Jun 21, 2002 12:12 am

Post by ace2600 »

Wow, that was easy to use. Does anyone know if they have a function like this number_format in the standard libraries of c or c++? I know this is php but its pretty much the same.
-Ace
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

for STL there is num_put that makes use of numpunct of the locale settings.
I'm not quite sure if printf makes use of the grouping-field in lconv
Post Reply