Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
PHP pow() Function
Definition and Usage
The pow () function is used to compute power of a certain number. It returns xy calculation, also termed as x raised to y. PHP also provides "**" asexponentiation operator.
So, pow(x,y) returns xy which is same as x**y
Syntax
pow ( number $base , number $exp ) : number
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
base The base to be raised |
| 2 |
exp power to which base needs to be raised |
Return Values
PHP pow() function returns base raised to power of exp. If both arguments are non-negative integers,the result is returned as integer, otherwise it is returned as a float.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
<?php $radius=5; echo "radius = " . $radius . " area = " . M_PI*pow(5,2); ?>
Output
This will produce following result −
radius = 5 area = 78.539816339745
Advertisements
