Home » PHP pow() function

PHP pow() function

by Online Tutorials Library

PHP pow() function

The pow() is a PHP mathematic function. It raises the first number to the power of the second number.

Syntax:

Parameter Description Required /Optional
base Required. Specifies the base to use. required
exp Required. Specifies the exponent. required

Return Value: Returns a number (floating-point & Integer) which is equal to $base raised to the power of $exponent.

Example 1

Test it Now

Output:

Your number is =pow(3, 2) By using sqrt function Your number is : 9 

Example 2

Test it Now

Output:

Your number is = pow (-4, 2) By using sqrt function Your number is : 16 

Example3

Test it Now

Output:

Your number is =pow(-3, -3) By using sqrt function Your number is : -0.037037037037037 

Example4

Test it Now

Output:

Your number is =pow(-3, -3.2) By using sqrt function Your number is : NAN 

Example 5

Test it Now

Output:

The power value of [1] is=1 The power value of [2] is=4 The power value of [3] is=9 The power value of [4] is=16 The power value of [5] is=25 

Next TopicPHP Math

You may also like