how to reformat a number with commas

前端 未结 4 1613
清酒与你
清酒与你 2020-12-20 02:43

I have a line of code that get a count of rows in my table and then display the count. In this case it display the number of downloads.

Right now the count is very s

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-20 02:49

    You can use the number_format() function:

    $str = number_format($number);
    

    To use "." instead of ",":

    $str = number_format($number, 0, ',', '.');
    

提交回复
热议问题