echo pow(2,3); // ouptut 8
Using variables
$a=3;
$b=4;
echo pow($a,$b); // output 81
Syntax
pow(base, exponent)
We get output as base raised to the power of exponent.
for($i=1;$i<=10;$i++){
echo $i. "=".pow($i,2)."<br>";
}
Output is here
1=1
2=4
3=9
4=16
5=25
6=36
7=49
8=64
9=81
10=100
How pow is used with sqrt function to get hypotenuse of a triangle