PHP sqrt() Function
Definition and Usage
The sqrt() function returns the square root of a number.
Syntax
sqrt(x)
Parameter | Description |
---|---|
x | Required. A number. |
Description
Returns x the square root.
Tips and Notes
Note:If the parameter x If the number is negative, the sqrt() function returns -1.#IND.
Example
In this example, we will return the square roots of different numbers:
<?php echo(sqrt(0)); echo(sqrt(1)); echo(sqrt(9)); echo(sqrt(0.64)); echo(sqrt(-9)); ?>
Output:
0 1 3 0.8 -1.#IND