php取浮点数后两位的方法
摘要:
$num = 10.4567; //第一种:利用round()对浮点数进行四舍五入echo round($num,2); //10.46 //第二种:利用sprintf格式化字符串$format_num = sprintf("%.2f",$num);echo $format_num; //10.46 阅读全文
posted @ 2018-12-14 14:21 流星飞雨 阅读(394) 评论(0) 推荐(0)
posted @ 2018-12-14 14:21 流星飞雨 阅读(394) 评论(0) 推荐(0)