函数名称:stats_stat_powersum()
函数描述:stats_stat_powersum() 函数计算给定数组中指定幂次的幂和。
适用版本:stats_stat_powersum() 函数在 PHP 4 >= 4.0.7, PHP 5, PHP 7 版本中可用。
语法:float stats_stat_powersum ( array $arr, float $power )
参数:
返回值:返回给定数组中指定幂次的幂和,如果出错则返回 FALSE。
示例:
$arr = [1, 2, 3, 4, 5];
$power = 2;
$result = stats_stat_powersum($arr, $power);
echo "幂次为 $power 的幂和为:$result";
输出:
幂次为 2 的幂和为:55
注意事项: