In mathematics, a number "raised" to an exponent takes a base number and multiplies it by itself a specified number of times—the exponent. For example, in mathematical notation, 4^5 represents the base integer four raised to the power of the exponent five. This is 4 x 4 x 4 x 4 x 4, which equals 1024. You can do the same thing in PHP using the **pow() function**, which is written using the syntax **pow(base number, exponent)**.

The example of 4^5 is written as pow(4, 5) in PHP coding.

### Pow() Examples in PHP Code

```
<?php
echo pow(5, 3) ;
echo "<br>";
echo pow(-3, 3) ;
echo "<br>";
echo pow(2, 4) ;
?>
```

Pow(5, 3) is the base number 5 multiplied by itself three times. 5 x 5 x 5=125.

Pow(-3, 3) is the base integer -3 multiplied by itself three times. -3 x -3 x -3=-27.

Pow(2, 4) is the base integer 2 multiplied by itself four times. 2 x 2 x 2 x 2=16

### Pow() Return Values

The code example outputs:

```
125
-27
16
```

If both numbers are non-negative integers and the returned value can be represented as an integer, the result is returned as an integer (whole number). If not, it is returned as a float (a fractional value with numbers on both sides of a decimal).

### Notes About the Pow() Function

This function works beginning with PHP 4. Older versions of PHP have trouble using negative bases and need some manipulation to work. They return "false" to this function.

Caution: The pow() function converts all input—even non-numerical values—to a number, which can lead to problems.