PHP Pow() Function

What we are going to see through this article is PHP Pow() Function. The pow () function in PHP is used to calculate the elevated base per layer power.

This is a common function that can be used with any number elevated to any value. It takes both the base and layer parameters and gives the desired answer.

This is a syntax of pow() built-in function to do a task below:

number pow($base(x), $exponent(y))
PHP Pow() Function

PHP Pow() Function

echo(pow(3,9) . "<br>");
echo(pow(-4,6) . "<br>");
echo(pow(-5,-3) . "<br>");

We have to provide four different types of base and exponent input values to test this program. Those are:

  • both positive base and exponent,
  • negative base and positive exponent,
  • both negative integer base and exponent,
  • negative integer base and negative float exponent.

Read Also: PHP Sum() Function


pow(3,9) = 19683
pow(-4,6) = 4096
pow(-5,-3) = -0.008
pow(-6,-5.8) = NAN


What we learned through this article is PHP Pow() Function. Also if you have any doubts please leave a comment via the comment box. And we ask that you benefit everyone who shared this article with your friends.

Leave a Comment