# How to Raise a Number to the Power of Another (Exponent) in PHP

You might need to raise a number to the power of another in a PHP script, for example (sometimes written 3^5), or in general . This may also be used with negative powers where . Of course, you’d probably want to do this for more complicated examples!

PHP has a function built in to do this: = `pow(x,n)`

.

## Examples of ‘Power Of’

Here are some examples, which raise a number to the power of another and display the output. In the examples, `<br />`

inserts a line break to display the results neatly.

And here is the output of this example code: