(PHP 8 >= 8.4.0)
A class for an arbitrary precision number. These objects support overloaded arithmetic and comparison operators.
Note: This class is not affected by the bcmath.scale INI directive set in php.ini.
Note: The behavior of an overloaded operator is the same as specifying
null
for thescale
parameter on the corresponding method.
$exponent
, BcMath\Number |string |int $modulus
, ? int $scale
= null
): BcMath\Number $precision
= 0, RoundingMode $mode
= RoundingMode::HalfAwayFromZero): BcMath\Number scale
parameter was set in the calculation method.
BcMath\Number is one of those classes that overloads boolean casting.
If $z = new BcMath\Number(0) then $z is considered falsy (and hence, for example, empty($z)==true) even though it is a genuine Number object.