fpow()
fpow() — Raise one number to the power of another, according to IEEE 754.
Built-in function of PHP 8.5. The manual lists it as available in PHP 8 >= 8.4.0. 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 raising num to the power of exponent. If num is zero and exponent is less than zero, then INF is returned.
Signature
fpow(float $num, float $exponent): float
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $num | float | The base to use. |
| $exponent | float | The exponent. |
Return value
Returns a float corresponding to $num$exponent.
Example
A runnable snippet:
var_dump(fpow(10, 2)); var_dump(fpow(0, -3)); var_dump(fpow(-1, 5.5));
Output:
float(100) float(INF) float(NAN)
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page fpow() (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.