四舍五入到最接近的十分之一? [英] Round to the nearest tenth?

查看:37
本文介绍了四舍五入到最接近的十分之一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
在 PHP 中四舍五入到最接近的 50,000 >

我有这个,52.52,我希望它变成 52.5.我将如何在 PHP 中做到这一点?我试过 round() 但没有用.谢谢.

I have this, 52.52 and I want it to become 52.5. How would I do that in PHP? I tried round() but did not work. Thanks.

推荐答案

round($num, 1);

应该将 $num 舍入到最接近的十分之一(第二个参数指定精度,或者它应该舍入到的小数点后的位数)

should round $num to the nearest tenth (the second argument specifies the precision, or the number of digits after the decimal it should round to)

这篇关于四舍五入到最接近的十分之一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆