php保留两位小数的几种方法
$num=10.4567;//第一种:利用round()对浮点数进行四舍五入echo round($num,2);//10.46//第二种:利用sprintf格式化字符串$format_num=sprintf(“%.2f”,$num);echo $format_num;//10.46//第三种:利用千位分组来格式化数字的函数number_format()echo number_format($num,2);//10.46//或者如下echo number_format($num,2,.,);//10/46ad:【百度云分享】大学生必备,互联网精品福利资源下载
未经允许不得转载:aft博客-给你需要的内容»php保留两位小数的几种方法
标签:织梦
上一篇织梦cms mip文章内容页图片适配百度mip规范下一篇所向披靡的响应式开发