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

相關文章
- PHP 安裝
- PHP 包含文件 include 和 require 語句
- PHP Secure E-mails
- PHP JSON
- PHP array() 函數
- PHP array_combine() 函數
- PHP array_filter() 函數
- PHP array_intersect_assoc() 函數
- PHP array_intersect_uassoc() 函數
- PHP array_key_exists() 函數
- PHP array_keys() 函數
- PHP array_splice() 函數
- PHP array_udiff() 函數
- PHP array_walk_recursive() 函數
- PHP count() 函數
- PHP each() 函數
- PHP next() 函數
- PHP pos() 函數
- PHP shuffle() 函數
- PHP Error 和 Logging 函數