PHP sqrt()Functions
Examples
Return the square root of different numbers:
<?php
echo(sqrt(0) . "<br>");
echo(sqrt(1) . "<br>");
echo(sqrt(9) . "<br>");
echo(sqrt(0.64) . "<br>");
echo(sqrt(-9));
?>
echo(sqrt(0) . "<br>");
echo(sqrt(1) . "<br>");
echo(sqrt(9) . "<br>");
echo(sqrt(0.64) . "<br>");
echo(sqrt(-9));
?>
Run example »
Definition and Usage
The sqrt() function returns the square root of a number.
Syntax
sqrt(number);
| Parameter | Description |
|---|---|
| number | Required. Specifies a number. |
Technical Details
| Return value: | Returnsnumberthe square root of, ifnumberis negative, returns NAN. |
|---|---|
| Return type: | Float |
| PHP Version: | 4+ |
PHP Math Reference Manual Other Extensions