PHP fmod () function
Examples
Returns the x / y of the floating-point remainder:
<?php
$x = 7;
$y = 2;
$result = fmod($x,$y);
echo $result;
// $result equals 1, because 2 * 3 + 1 = 7
?>
$x = 7;
$y = 2;
$result = fmod($x,$y);
echo $result;
// $result equals 1, because 2 * 3 + 1 = 7
?>
Running instance »
Definition and Usage
The fmod () function returns the x / y floating point remainder.
grammar
fmod( x,y );
参数 | 描述 |
---|---|
x | 必需。规定被除数。 |
y | 必需。规定除数。 |
technical details
return value: | Floating point remainder of x / y. |
---|---|
Return type: | Float |
PHP version: | 4.2+ |
PHP Math Reference