Computer >> Computer tutorials >  >> Programming >> PHP

pow() function in PHP


The pow() function Returns a raised to the power of b.

Syntax

pow(a,b)

Parameters

  • a − The base

  • b − The exponent

Return

The pow() function Returns a raised to the power of b.

Example

<?php
   echo(pow(3,5) . "<br>");
?>

Output

243<br>

Example

Let us see another example −

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

Output

4096<br>-5.0805263425291E-5<br>

Example

Let us see another example −

<?php
   echo(pow(-4,-5.3));
?>

Output

NAN