Definition: In mathematics, an exponent is used to take a number and multiply it by itself a certian a number of times. For example 4^5 (four to the power of five) would be 4*4*4*4*4, or 1024. We can do the same thing in PHP using the pow () function. It is written as pow(base, power) ; Our previous example of 4^5 would be written as pow (4, 5) ;
This would output:
<?php echo pow(5, 3) ; echo "<br>"; echo pow(-3, 3) ; echo "<br>"; echo pow(2, 4) ; ?>
Please note that while this will most likely work for you, older versions of PHP have trouble using negative bases, and need some manipulation to work. They will return false.
125 -27 16