如何在PHP中无余数地除数? [英] How to divide numbers without remainder in PHP?
本文介绍了如何在PHP中无余数地除数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在PHP中除数而不是其余数?
How does one divide numbers but exclude the remainder in PHP?
推荐答案
只需将结果值转换为int.
Just cast the resulting value to an int.
$n = (int) ($i / $m);
有趣的功能(取决于您要实现的功能以及您是否希望获得负整数)取决于 floor()
a>, ceil()
和
Interesting functions (depending on what you want to achieve and if you expect negative integers to get devided) are floor()
, ceil()
and round()
.
这篇关于如何在PHP中无余数地除数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文