sqrt

(PHP 4, PHP 5, PHP 7, PHP 8)

sqrt平方根

說(shuō)明

sqrt(float $arg): float

返回 arg 的平方根。

參數(shù)

arg

要處理的參數(shù)

返回值

返回 arg 的平方根,負(fù)數(shù)時(shí)返回 NAN。

范例

示例 #1 sqrt() 例子

<?php
// Precision depends on your precision directive
echo sqrt(9); // 3
echo sqrt(10); // 3.16227766 ...
?>

參見

  • pow() - 指數(shù)表達(dá)式