The fmod() function returns the remainder (modulo) of x/y.
PHP fmod() Function has the following syntax.
fmod(x,y);
Parameter | Is Required | Description |
---|---|---|
x | Required. | Dividend |
y | Required. | Divisor |
Item | Description |
---|---|
Return Value | The floating point remainder of x/y |
Return Type | Float |
Return the remainder of x/y:
<?php
$x = 7;
$y = 2;
$result = fmod($x,$y);
echo $result;
?>
$result equals 1, because 2 * 3 + 1 = 7
The code above generates the following result.