php

mod or remainder using fmod() PHP

<?php
    echo fmod(15, 5); //output - 0
    echo fmod(15, 4); //output - 3
?>
Output
0
3

To find the remainder of a/b, you can use fmod() function of PHP. This takes two required parameters. The first parameter is the value that needs to be divided and the second is from which number it is to be divided.

Was this helpful?