PHP sqrt() Function Example

PHP sqrt() Function Example


Posted in : PHP Posted on : January 28, 2011 at 5:46 PM Comments : [ 0 ]

If you want to find out the square root of a number then use sqrt() function.

PHP sqrt() Function Example:

If you want to find out the square root of a number then use sqrt() function. This function return square root of a number. The sqrt() function will return NAN if the number is a negative.

Syntax:

sqrt(number)

Example:

<?php
echo(sqrt(0) . "<br />");
echo(sqrt(9) . "<br />");
echo(sqrt(0.64) . "<br />");
echo(sqrt(-9))
?> 

Output:

The output of this example is:

0
3
0.8
NAN

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics