开发者

How to put a dot after three digits of a number

do you know how can i put a dot (.) after 3 digits of a number(sta开发者_StackOverflow社区rting from the end) in php? example: the number 1254631 to be shown as 1.254.631??


if you want to pretty print a number, number_format is nice

echo number_format(1254631 , 0, ',', '.');  // prints 1.254.631

the last argument is the thousands separator (dot in your case)


Use the number_format function


You are looking for number_format.


$printThisNumber = number_format($getThisNumber, 2, '.', ',');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜