【转】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