嘿,我用这段代码计算我的表:
$county = mysql_query("SELECT COUNT(id) from table where type = 'application'");
$county = mysql_result($county, 0);
$applications = ''.$county.'';
Run Code Online (Sandbox Code Playgroud)
这给我的结果像1156563.但我希望看到它像1,156,563逗号.我怎样才能做到这一点?
Tom*_*igh 10
number_format() 应该是你需要的
如果只给出一个参数,则数字将被格式化为没有小数,但在每组数千之间使用逗号(",").
<?php
echo number_format(23124154);
//output: 23,124,154
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1810 次 |
| 最近记录: |