Skip to main content
Known Participant
January 6, 2008
Question

Dynamically convert a 4-digit or more number to include comma seperations

  • January 6, 2008
  • 3 replies
  • 467 views
I know there's a way to do this but I can't seem to figure it out. How can I make sure when I'm representing a numeric object that it includes the comma after three digits? So that '1000' reads '1,000'?
This topic has been closed for replies.

3 replies

ladobeugmAuthor
Known Participant
January 6, 2008
Found it!

You do something like this:
<?php echo number_format($row_rsRecordset['number'],0,'.',','); ?>

instead of:
<?php echo $row_rsRecordset['number']; ?>
Inspiring
January 6, 2008
.oO(databell)

>I know there's a way to do this but I can't seem to figure it out. How can I
>make sure when I'm representing a numeric object that it includes the comma
>after three digits? So that '1000' reads '1,000'?

Which programming language?

Micha
Inspiring
January 6, 2008
databell wrote:
> I know there's a way to do this but I can't seem to figure it out. How can I
> make sure when I'm representing a numeric object that it includes the comma
> after three digits? So that '1000' reads '1,000'?

When asking this sort of question, you should say which server
technology you're using. In PHP, it's done with number_format():

http://docs.php.net/manual/en/function.number-format.php

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/