7

Can anyone tell what does ** exponentiation operator do in php ?

Examples will be more useful.

Thanks

1 Answers1

4

It is exponentiation operator.

Functionality :

It gives Result of raising one variable to the other varibale's power So if we want nth power of any number for that this operator is used

Example :

$x = 5;
$y = 3;
$z = $x ** $y; //<----- raising 3 power of 5 i.e we can say 5 raise to 3 in simple language . $x = base and $y= It is `exponentiation` operator.
echo $z; //results 125
B. Desai
  • 16,414
  • 5
  • 26
  • 47