PHP pow() Function
Example
Examples of pow():
<?php
echo(pow(2,4) . "<br>");
echo(pow(-2,4) . "<br>");
echo(pow(-2,-4) . "<br>");
echo(pow(-2,-3.2));
?>
Try it Yourself »
Definition and Usage
The pow() function returns x raised to the power of y.
Syntax
pow(x,y);
Parameter Values
Parameter | 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: | Integer if possible, Float otherwise |
PHP Version: | 4+ |
PHP Changelog: | PHP 4.0.6: Will now return integer if possible. Earlier it only returned float PHP 4.2.0: No warning is issued on errors |
❮ PHP Math Reference