Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP sqrt() Function

PHP sqrt() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Return the square root of different numbers:

"); echo(sqrt(1) . "
"); echo(sqrt(9) . "
"); echo(sqrt(0.64) . "
"); echo(sqrt(-9)); ?>

Run Example »


Definition and Usage

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


Syntax

sqrt(

number

);

Parameters Description
number Required. Specifies a number.

Technical Details

Return Value: Return number The square root of, if number is negative, NAN is returned.
Return Type: Float
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual