嘿嘿,我用这段代码来数我的 table :
$county = mysql_query("SELECT COUNT(id) from table where type = 'application'");
$county = mysql_result($county, 0);
$applications = ''.$county.'';
这给我的结果类似于 1156563。但我希望看到它类似于带逗号的 1,156,563。我该怎么做?
最佳答案
number_format()
应该是你需要的
If only one parameter is given, number will be formatted without decimals, but with a comma (",") between every group of thousands.
<?php
echo number_format(23124154);
//output: 23,124,154
关于php - 如何在计数中加上逗号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2675205/