Formatting Numbers Using number_format()

Creator:
jax

Let's say that you have a counter script on a popular site that you coded yourself. What if you get well over 1,000 hits? Without proper formatting the number would be displayed as 1000 without any commas.

Using number_format you can change this.

Here is a basic number format:



<? $number 1000; echo number_format($number); ?>

Description:
Using number_format() you can add commas to long numbers.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options