PHP fmod() Function Example

PHP fmod() Function Example


Posted in : PHP Posted on : January 28, 2011 at 5:56 PM Comments : [ 0 ]

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 

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics