PHP fmod()Function

PHP Math 参考手册PHP Math Reference Manual

Examples

Returns the floating-point remainder of x/y:

<?php
$x = 7;
$y = 2;
$result = fmod($x,$y);
echo $result;
// $result equals 1, because 2 * 3 + 1 = 7
?>

Run example »

Definition and Usage

The fmod() function returns the floating-point remainder of x/y.


Syntax

fmod(x,y);

Parameters Description
x Required. Specifies the dividend.
y Required. Specifies the divisor.

Technical Details

Return Value: The floating-point remainder of x/y.
Return Type: Float
PHP Version: 4.2+


PHP Math 参考手册PHP Math Reference Manual Other Extensions