How to raise a number to the power

This forum covers all minor versions of PHP 7
Post Reply
User avatar
Administrator
Site Admin
Posts: 1725
Joined: Thu Mar 22, 2018 10:19 am

How to raise a number to the power

Post by Administrator » Fri Aug 24, 2018 10:40 am

To raise a number to the power in PHP 7 you can use the double asterisk

Code: Select all

**
Operator

Code: Select all

$a = 5;
$b = 2;

$a ** $b;
The Exponent can also be a negative number

Post Reply