PHP: pow() function
Description
The pow() function raises the first number to the power of the second number.
Version:
(PHP 4 and above)
Syntax:
pow(a,b)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
a | The first number or base number to use. | Required | Float/integer |
b | The second number or the exponent. | Required | Float/integer |
Return value:
The result of raising a to the power of b.
Value Type: Float/integer
Pictorial Presentation
Example:
<?php
echo pow(7,3) . '<br>';
echo pow(2,3) . '<br>';
echo pow(-2,3) . '<br>';
echo pow(-2,-3) . '<br>';
echo pow(-2,-3.2) . '<br>';
?>
Output:
343 8 -8 -0.125 NAN
View the example in the browser
See also
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/php/function-reference/pow.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics