PHP: log() function
Description
The log() function returns the natural logarithm of a number.
Version:
(PHP 4 and above)
Syntax:
log(number,nbase)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
number | The value to calculate the logarithm. | Required | Float |
nbase | The base to use. Default is 'e'. | Optional | Float |
Return value:
The logarithm of number to nbase, if given, or the natural logarithm.
Value Type: Float.
Example :
<?php
echo(log(2) . "<br />");
echo(log(1.234) . "<br />");
echo(log(0) . "<br />");
echo(log(1) . "<br />");
?>
Output :
0.69314718056 0.210260925483 -INF 0
View the example in the browser
See also
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics