FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

PHP sqrt() Function

PHP Math Reference PHP Math Reference

Example

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));
?>
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: The square root of number, or NAN for negative numbers
Return Type: Float
PHP Version: 4+

PHP Math Reference PHP Math Reference