bcpow
is a function in PHP that calculates the value of the arbitrary precision number raised to the power of another number.
bcpow(string $num, string $exp, int $scale = null): string
num
- It is the base number. num
is of type string
.
exp
- It is the exponent. exp
is of the integer type.
scale
- variable of type int
. It is an optional parameter. scale
is used to set the number of digits after the decimal place in the result. The default value of scale
is 0.
The function returns the value of num
raised to the exp
. The value returned is of type string
.
<?php$num1 = '4.2';$num2 = '3';echo bcpow($num1, $num2);echo bcpow($num1, $num2, 2);?>
74
74.08