之前曾经一直使用自己定义的数字格式化方法,原来PHP一直有个数字格式化函数的,呵呵~
例如,echo number_format(285266237);
可以输出 285,266,237
另外如果需要格式化文件字节大小,下面的方法可以借鉴:
function byte_format($input, $dec=0)
{
$prefix_arr = array(" B", "K", "M", "G", "T");
$value = round($input, $dec);
$i=0;
伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-03/1172834650.html
while ($value>1024)
数字格式化
'http://www.etoow.com/html/2007-03/1172834650.html