实例
pow() 的实例:
<?php echo(pow(2,4) . "<br>");echo(pow(-2,4) . "<br>");echo(pow(-2,-4) . "<br>");echo(pow(-2,-3.2));?>
运行代码 >>
定义和用法
pow() 函数返回 x 的 y 次方。
语法
pow(x,y);
参数 | 描述 |
---|---|
x | 必需。规定要使用的底。 |
y | 必需。规定指数。 |
技术细节
返回值: | x 的 y 次方。 |
---|---|
返回类型: | 如果可能则返回 Integer,否则返回 Float。 |
PHP 版本: | 4+ |
PHP 更新日志: | PHP 4.0.6:如果可能则返回 integer。之前的版本只返回 float。 PHP 4.2.0:如果发生错误则不产生任何的警告。 |
