BcMath\Number::floor
(PHP 8 >= 8.4.0)
BcMath\Number::floor — Rounds down an arbitrary precision number
说明
Returns the next highest integer value by rounding down $this if necessary.
参数
此函数没有参数。
返回值
Returns the result as a new BcMath\Number object.
The BcMath\Number::scale of the result is always 0
.
示例
示例 #1 BcMath\Number::floor() example
<?php
$num1 = new BcMath\Number('4.3')->floor();
$num2 = new BcMath\Number('9.999')->floor();
$num3 = new BcMath\Number('-3.14')->floor();
var_dump($num1, $num2, $num3);
?>
以上示例会输出:
object(BcMath\Number)#2 (2) { ["value"]=> string(1) "4" ["scale"]=> int(0) } object(BcMath\Number)#3 (2) { ["value"]=> string(1) "9" ["scale"]=> int(0) } object(BcMath\Number)#4 (2) { ["value"]=> string(2) "-4" ["scale"]=> int(0) }
参见
- bcfloor() - Round down arbitrary precision number
- BcMath\Number::ceil() - Rounds up an arbitrary precision number
- BcMath\Number::round() - Rounds an arbitrary precision number
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。