[英]Perfectly round a number in PHP
So, i retrieved with an API a number, which is 1441971834999104426
.所以,我用 API 检索了一个数字,即1441971834999104426
。 I would like to round it to 1441971835
我想将它四舍五入到1441971835
However, when i do: round(1441971834999104426, -9);
但是,当我这样做时: round(1441971834999104426, -9);
the output is: 1.441971835E+18
, which is not what i want at all. output 是: 1.441971835E+18
,这根本不是我想要的。
Can you give me some advices on how I can do the rounding perfectly?你能给我一些关于如何完美地进行四舍五入的建议吗?
Thanks to you.谢谢你。
Divide the number by 1e9
, and round that.将数字除以1e9
,然后四舍五入。
echo round(1441971834999104426/1e9);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.