PHP number_format() 函数

定义和用法

number_format() 函数通过千位分组来格式化数字。

语法

1 number_format(number,decimals,decimalpoint,separator)
1 <?php
2 echo number_format("1000000");
3 echo number_format("1000000",2);
4 echo number_format("1000000",2,",",".");
5 ?>

输出:

1 1,000,000
2 1,000,000.00
3 1.000.000,00

 

posted @ 2015-04-27 13:44  php-study  阅读(502)  评论(0编辑  收藏  举报