If you want to take remainder of the division then use fmod() function.
PHP fmod() Function Example:
If you want to take remainder of the division then use fmod() function. The fmod() function return remainder of the division. Suppose you divide a by b then fmod() function divide a by b and return the the remainder of the division.
Syntax:
fmod(a, b)
a and b are two numbers.
Example:
<?php $remainder = fmod(6, 2); echo "Remainder is :" . $remainder."<br />"; echo "<br />"; $remaind = fmod(7, 2); echo "Remainder is :" . $remaind; ?>
After running this example the output is:
Output:
Remainder is :0 Remainder is :1
[ 0 ] Comments