Latest web development tutorials

PHP sqrt () function

PHP Math Reference PHP Math Reference

Examples

Returns the square root of the number of different:

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

Running instance »

Definition and Usage

sqrt () function returns the square root of a number.


grammar

sqrt( number );

参数 描述
number 必需。规定一个数。

technical details

return value: Returns the number of square root, if the number is negative returns NAN.
Return type: Float
PHP version: 4+


PHP Math Reference PHP Math Reference