fmod()
Published Jul 20, 2023
Contribute to Docs
The fmod()
function returns the remainder (modulo) of x/y. The name stands for “floating modulo” and the function calculates the modulo of any division which may contain a float
as both dividend and divisor.
Syntax
fmod(x,y);
The function takes two required parameters - the x
specifies the dividend and the y
specifies the divisor.
Example
This example returns the remainder of x
and y
.
<?php$x = 27;$y = 5;$remainder = fmod($x,$y);echo $remainder;?>
The output will be:
2
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.