fdiv()
fdiv() — Divides two numbers, according to IEEE 754.
Built-in function of PHP 8.5. The manual lists it as available in PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Returns the floating point result of dividing the num1 by the num2. If the num2 is zero, then one of INF, -INF, or NAN will be returned.
Signature
fdiv(float $num1, float $num2): float
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $num1 | float | The dividend (numerator) |
| $num2 | float | The divisor |
Return value
The floating point result of num1/num2
Example
A runnable snippet:
var_dump(fdiv(5.7, 1.3)); // float(4.384615384615385) var_dump(fdiv(4, 2)); // float(2) var_dump(fdiv(1.0, 0.0)); // float(INF) var_dump(fdiv(-1.0, 0.0)); // float(-INF) var_dump(fdiv(0.0, 0.0)); // float(NAN)
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page fdiv() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.