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 sqrt() Function
Definition and Usage
The sqrt() function returns square root of a positive float number. Since square root for negative number is not defined, it returns NAN. This is one of the most commonly used functions.
This function always returns a floating point number.
Syntax
sqrt ( float $arg ) : float
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
arg a number whose square root is to be obtained |
Return Values
PHP sqrt() function returns square root of the given arg number. For negative number, the function returns NAN.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
<?php echo "sqrt(-1) = " . sqrt(-1) . "
"; ?>
Output
This will produce following result −
sqrt(-1) = NAN
Advertisements
