sqrt()


float sqrt ( float $arg )

Description

sqrt() returns the square root of $arg

※ available F/W version : all

Parameters

Return values

Returns the square root of $arg or the special value NAN for negative numbers

Example

<?php
$arg1 = 2.0;
$ret1 = sqrt($arg1);
$arg2 = -2.0;
$ret2 = sqrt($arg2);

echo "ret1 = $ret1\r\n";  // OUTPUT: ret1 = 1.4142135623731
echo "ret2 = $ret2\r\n";  // OUTPUT: ret2 = NAN
?>

See also

pow()

Remarks

This function is identical to the PHP group’s sqrt() function.