42 of 410 menu

The pow Function

The pow function raises a number to a specified power.

Syntax

pow(number, exponent);

Example

Let's raise the number 2 to the power of 3:

<?php echo pow(2, 3); ?>

Code execution result:

8

See Also

  • the powering numbers tutorial,
    which covers the ** operator
  • the sqrt function,
    which calculates the square root of a number
byenru