PHP fmod() Function – Returns Floating‑Point Remainder of Division
This article explains PHP's fmod() function, detailing its syntax, parameter meanings, return value, and provides a practical code example that demonstrates how it calculates the floating‑point remainder of a division operation.
The article describes the PHP fmod() function, which returns the floating‑point remainder of dividing one number by another.
Syntax
float fmod ( float $x, float $y )
Parameters
$x – the dividend.
$y – the divisor (must be non‑zero).
Return value
The function returns the remainder r such that x = i * y + r , where i is an integer; the sign of r matches the sign of x and its absolute value is less than y .
Example
The output comment shows that $r equals 0.5 , confirming the function’s behavior.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.