bcmod
bcmod
Get modulus of an arbitrary precision number
string **bcmod** string $num1 string $num2 $scale
Get the remainder of dividing by
.
The result has the same sign as .
num1``num2``num1
Returns the modulus as a string.
Voorbeeld: example
<?php
bcscale(0);
echo bcmod( '5', '3'); // 2
echo bcmod( '5', '-3'); // 2
echo bcmod('-5', '3'); // -2
echo bcmod('-5', '-3'); // -2
?>
Voorbeeld: with decimals
<?php
bcscale(1);
echo bcmod('5.7', '1.3'); // 0.5 as of PHP 7.2.0; 0 previously
?>
bcdiv``bcdivmod``BcMath\Number::mod