Account
Categories

Exponentiation Operator


You use the exponentiation operator (**) in a webpage for mathematical calculation.

It helps in raising one value (number) to the power of another, which are also called operands, and together with the double asterisk (**), they perform the exponentiation.

Syntax:

$result = $left_operand ** $right_operand;

Example:

<?php
$a = 2;
$b = 3;
$exp = $a ** $b;
echo "The power is: ". $exp;
?>

Output:

The power is: 8