bcmod
Description
Syntax
bcmod( string $num1, string $num2, ?int $scale = null ): string
Parameters
num1
The dividend, as a string.
num2
The divisor, as a string.
scale
Sets the number of digits after the decimal place in the result.
If omitted, it will default to the scale set globally with the bcscale() function, or fallback to 0 if this has not been set.
Return
Returns the modulus as a string, or null if num2 is 0.
Examples
1 · num1 num2
<? $num1 = '1.234'; $num2 = '5'; $return = bcmod($num1, $num2); echo $return;
1
2 · scale
<? $num1 = '1.234'; $num2 = '5'; $scale = 6; $return = bcmod($num1, $num2, $scale); echo $return;
1.234000
3 · bcscale
<? $scale = 6; bcscale($scale); $num1 = '1.234'; $num2 = '5'; $return = bcmod($num1, $num2); echo $return;
1.234000