# PHP program to find the power of any number x^y

PHP program to find the power of any number x^y. There are you will learn how to find the power of any number x^y in PHP language.

**Formula:**

*r = b ^ y*

**where:**

`r = result`

`b = base value`

`y = exponent value`

There are two ways to implement these formulae:

- By using the default method
- Second, by using
**pow()**function

1. By using the default method

```
<?php
// PHP program to find the power of any number
$b = 5;
$e = 7;
$r = 1;
$i = 1;
// b = base
// e = exponent
// r = result
// finding power of base value by equiping exponent value
while($i <= $e)
{
$r *= $b;
$i++;
}
// Output
echo "Result:: " . $b . "^" . $e . " = " . $r;
?>
```

**Output Screen:**

Result:: 5^7 = 78125

2. By using **pow()** function

```
<?php
// PHP program to find the power of any number by using pow() function
$b = 5;
$e = 7;
$r = 1;
// b = base
// e = exponent
// r = result
// finding power of base value by equiping exponent value
$r = pow($b, $e);
// Output
echo "Result:: " . $b . "^" . $e . " = " . $r;
?>
```

**Output Screen:**

Result:: 5^7 = 78125