打赏

2018年12月28日

php保留两位小数的方法

摘要: 1 <?php 2 $num = 8.16789; 3 4 //第一种:利用round()对浮点数进行四舍五入 5 echo round($num,2).PHP_EOL; //8.17 6 7 //第二种:利用sprintf格式化字符串() 8 $format_num = sprintf("%.2f 阅读全文

posted @ 2018-12-28 15:10 头大的冯冯 阅读(196) 评论(0) 推荐(0) 编辑

导航