PHP fmod()


fmod(x,y) function returns the remainder of x divided by y.

<?PHP
$x = 9;
$y = 2;
echo fmod($x,$y); //1
?>

It supports float type.
<?PHP
$x = 9.5;
$y = 2;
echo fmod($x,$y); //1.5
?>

Example of both parameters are float numbers.
<?PHP
$x = 9.5;
$y = 2.5;
echo fmod($x,$y); //2
?>

Example of both parameters are float numbers.
<?PHP
$x = 9.7;
$y = 2.5;
echo fmod($x,$y); //2.2
?>