PHP fmod() Function Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report fmod stands for Floating Modulo. Modulo calculates the remainder of a division which is generally noted with the '%' symbol. However, the general modulo expression expects both the divisor and dividend to be of integer type, this is a great limitation to such an important operation. In PHP the fmod() function is used to calculate the Modulo of any division which may contain floats as both dividends and divisors. Syntax: float fmod ($dividend, $divisor) Parameters: The function takes two parameters as follows: $dividend: This parameter takes a float which is to be divided. $divisor: This parameter takes a float which is to be used as a divisor. Return Type: This function returns a Floating-point remainder of the division. Examples: Input : $dividend = 2.7, $divisor = 1.3; Output : 0.1 Input : $dividend = -2.7, $divisor = 1.1; Output : -0.5 Below program illustrates the working of fmod() in PHP: PHP <?php // PHP code to illustrate the // working of fmod() Function $dividend = 2.5; $divisor = 1.1; for(;$divisor<1.25;$divisor+=0.05) echo $dividend.' % '.$divisor.' = '. fmod($dividend, $divisor)."\n"; ?> Output: 2.5 % 1.1 = 0.3 2.5 % 1.15 = 0.2 2.5 % 1.2 = 0.1 Important points to note: fmod() function returns Floating Point Modulo. fmod() is an approximation method and may not always return the accurate result. Reference: http://php.net/manual/en/function.fmod.php Comment More infoAdvertise with us Next Article PHP fmod() Function P PronabM Follow Improve Article Tags : Misc Web Technologies PHP PHP-math PHP-function +1 More Practice Tags : Misc Similar Reads PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read PHP end() Function The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.Syntax:end($array)Parameters:This function accepts a single par 2 min read PHP cos( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. The cos()function in PHP is used to find the cosine of a number. The cos() function returns a float value between -1 and 1, which r 2 min read PHP acos( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. One of such function is acos() function. The acos() function in PHP is used to find the arc cosine of a number in radians. We alrea 2 min read PHP fileinode() Function The fileinode() function is an inbuilt function in PHP that returns the inode of the file. Syntax: fileinode(string $filename): int|falseParameter: This function has only one parameter: filename: This parameter specifies the path for the particular file.Return Value: This function returns the inode 1 min read Like