How to automatically add ',' to numbers in PHP?
So that 335000 开发者_JS百科become 335,000?
You can use the number_format
function :
$number = 335000;
echo number_format($number);
Will get you :
335,000
And, if necessary, you can use the additionnal parameters (see the manual page) to use a different number of digits, another decimal separator, ...
精彩评论