PHP Math functions pow

echo pow(2,3); // ouptut 8
Using variables
$a=3; 
$b=4; 
echo pow($a,$b); // output 81
Syntax
pow(base, exponent)
We get output as base raised to the power of exponent.

Example

We can create a square table by using for loop
for($i=1;$i<=10;$i++){
echo $i. "=".pow($i,2)."<br>";
}
Output is here
1=1
2=4
3=9
4=16
5=25
6=36
7=49
8=64
9=81
10=100
How pow is used with sqrt function to get hypotenuse of a triangle

Math Functions base_convert(): Convert number From any base to other decbin() Binary equivalent of decimal number dechex(): Convert decimal number to hexadecimal system
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer