Latest web development tutorials

PHP pow () function

PHP Math Reference PHP Math Reference

Examples

pow () Examples:

<?php
echo(pow(2,4) . "<br>");
echo(pow(-2,4) . "<br>");
echo(pow(-2,-4) . "<br>");
echo(pow(-2,-3.2));
?>

Running instance »

Definition and Usage

pow () function returns x to the power y.


grammar

pow( x,y );

参数 描述
x 必需。规定要使用的底。
y 必需。规定指数。

technical details

return value: x to the power of y.
Return type: If possible, return Integer, otherwise Float.
PHP version: 4+
PHP Update Log: PHP 4.0.6: If possible returns integer. The previous version only returns float.
PHP 4.2.0: If an error occurs in any of the warning will not be generated.


PHP Math Reference PHP Math Reference