php The sqrt function is used to return the square root of a number. Its syntax is sqrt(x). The parameter x is required and refers to a number.
#How to use php sqrt function?
Definition and usage
sqrt() function returns the square root of a number.
Syntax
sqrt(x)
Parameters
x Required. a number.
Description
Returns the square root of x.
Tips and Notes
Note: If the parameter x is a negative number, the sqrt() function returns -1.#IND.
Example
In this example we will return the square roots of distinct 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
The above is the detailed content of How to use php sqrt function?. For more information, please follow other related articles on the PHP Chinese website!