[PHP] Putting commas in numbers

Status
Not open for further replies.

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
I know this isn't much of a tutorial, but it's one problem in PHP that gets to coders quite a lot - how to put commas in numbers.

Instead of having a number outputted like "56298", you can put commas in it.

The code is very simple.

PHP:
<?php
$number = 56298;
echo number_format( $number );
?>

That will output:

Code:
56,298
 
Status
Not open for further replies.

Users who are viewing this thread

Top