Reputation: 15
If you example I have this php:
$var = $_POST['somefield'];
and suppose the value of 'somefield' is 2050, how do I make php output this as:
2,050
instead of
**2050** ?
Upvotes: 0
Views: 47
Reputation: 2415
Assuming you meant: "2,050 instead of 2050"
Now you want to format the no, so that thousands are seperated by commas. Please have a look at This.
And as for your code you can do this (but please read that link before)
$var = $_POST['somefield'];
$var = number_format($var);
Upvotes: 0
Reputation: 72971
Example:
// assuming US format
echo number_format($_POST['somefield']);
Upvotes: 3