How can I add commas to numbers in PHP

后端 未结 4 1806
难免孤独
难免孤独 2020-11-30 05:45

I would like to know how can I add comma\'s to numbers. To make my question simple.

I would like to change this:

1210 views

To:

4条回答
  •  感情败类
    2020-11-30 05:48

    The Following code is working for me, may be this is helpful to you.

    $number = 1234.56;
    
    echo number_format($number, 2, '.', ',');
    

    //1,234.56

提交回复
热议问题