Search code snippets, questions, articles...

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.

Search Index Data (The code snippet can also be found with below search text)

fmod() function PHP
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet