【转】PHP数字价格格式化,保留两位小数

更新于 2019-05-05 14:06 394
专栏: PHP 标签: php

转载自:https://www.cnblogs.com/lhm166/articles/5789489.html

  1.   echo number_format("1000000");
  2.   echo number_format("1000000",2);
  3.   echo number_format("1000000",2,",",".");
  4.   echo number_format("1000000",2,"*",".");
  5.   echo number_format("1000000",2,".","");
  1. 输出:
  2. 1,000,000
  3. 1,000,000.00
  4. 1.000.000,00
  5. 1.000.000*00
  6. 1000000.00