PHP number_format ( )
2010-4-29 杜世伟
定义和用法
该number_format ( )函数的格式了一些与分组数千人。
语法
number_format(number,decimals,decimalpoint,separator)
number |
必需的。数量进行格式化。如果没有其他参数的设置,将一些不格式化小数和逗号( , )作为分隔数以千计。
|
decimals |
任择。指定多少个小数。如果这个参数设定的数目将格式化一个点( 。 )作为小数点。
|
decimalpoint |
任择。什么字符串指定要使用的小数点。
|
separator |
任择。什么字符串指定要使用的千位分隔符。只有第一个字符分隔的使用。举例来说,的“ XXX ”将给予相同的输出作为“ × ” 。注意:如果这个参数是,所有其他参数是需要的。
|
提示和说明 注:此功能支持一个,两个,或四个参数(而不是3个) 。 例如
<?php echo number_format("1000000"); echo "<br />"; echo number_format("1000000",2); echo "<br />"; echo number_format("1000000",2,",","."); ?>
结果.
1,000,000 1,000,000.00 1.000.000,00
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)