how to reformat a number with commas

前端 未结 4 1241
忘掉有多难
忘掉有多难 2020-12-20 02:36

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:46

    You can use the number_format() function:

    $str = number_format($number);
    

    To use "." instead of ",":

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

提交回复
热议问题