PHP sqrt() 函數
PHP Math 參考手冊
實例
返回不同數的平方根:
<?php
echo(sqrt(0) . "<br>");
echo(sqrt(1) . "<br>");
echo(sqrt(9) . "<br>");
echo(sqrt(0.64) . "<br>");
echo(sqrt(-9));
?>
運行實例 ?
定義和用法
sqrt() 函數返回一個數的平方根。
語法
技術細節
返回值: | 返回 number 的平方根,如果 number 是負數則返回 NAN。 |
返回類型: | Float |
PHP 版本: | 4+ |
PHP Math 參考手冊