Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math fmod() function is used to return remainder (modulo) of the division of specified arguments.

Syntax

fmod(x, y)

Parameters

x Required. Specify the dividend.
y Required. Specify the divisor.

Return Value

Returns remainder of the division of arguments (x/y).

Example:

In the below example, fmod() function is used to return the remainder of division of specified arguments.

<?php
echo fmod(10, 3)."\n";
echo fmod(15, 3)."\n";
echo fmod(25.5, 7)."\n";
echo fmod(-10, -3)."\n";
?>

The output of the above code will be:

1
0
4.5
-1

❮ PHP Math Functions