|
|
PHP sqrt() - Math Functions
|
Tutorials » Php »
|
Topic |
What is sqrt Function?
|
|
Explanation |
|
The "sqrt()" function returns the square root of a number.
Syntax:
sqrt(x)
In the above syntax "x" is the number for which the square root is to be calculated.
Example:
<?php
echo(sqrt(0)) ."</br>";
echo(sqrt(1)) ."</br>";
echo(sqrt(4)) ."</br>";
echo(sqrt(0.49)) ."</br>";
echo(sqrt(-4)) ."</br>";
?>
Result:
0
1
2
0.7
NAN
In the above example the square root for a negative number returns "NAN".
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|