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

ParameterTypeWhat it takes
$numfloatThe base to use.
$exponentfloatThe 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

pow(), fdiv(), fmod()

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.