log
(PHP 4, PHP 5, PHP 7, PHP 8)
log — 自然對數
說明
log(float
$arg, float $base = M_E): float
如果指定了可選的參數 base,log()
返回 logbase
arg,否則 log()
返回參數 arg 的自然對數。
參數
-
arg -
要計算對數的值
-
base -
The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm).
返回值
返回 logbase
arg,或者它的自然對數。
更新日誌
| 版本 | 說明 |
|---|---|
| 4.3.0 |
可選參數 base可用。
你可以計算任意以 b 為底 n
的對數,但其實使用的是數學等式:logb(n) =
log(n)/log(b),其中 log 是自然對數。
|