PHP pow()Functions
Examples
Example of pow():
<?php
echo(pow(2,4) . "<br>");
echo(pow(-2,4) . "<br>");
echo(pow(-2,-4) . "<br>");
echo(pow(-2,-3.2));
?>
echo(pow(2,4) . "<br>");
echo(pow(-2,4) . "<br>");
echo(pow(-2,-4) . "<br>");
echo(pow(-2,-3.2));
?>
Run Example »
Definition and Usage
The pow() function returns x raised to the power of y.
Syntax
pow(x,y);
| Parameters | Description |
|---|---|
| x | Required. Specifies the base to use. |
| y | Required. Specifies the exponent. |
Technical Details
| Return Value: | x raised to the power of y. |
|---|---|
| Return Type: | Returns Integer if possible, otherwise Float. |
| PHP Version: | 4+ |
| PHP Changelog: | PHP 4.0.6: Returns integer if possible. Prior versions only returned float. PHP 4.2.0: No warning is generated if an error occurs. |
PHP Math Reference Manual Other Extensions