PHP log () function
Examples
Returns the natural logarithm different numbers:
<?php
echo(log(2.7183) . "<br>");
echo(log(2) . "<br>");
echo(log(1) . "<br>");
echo(log(0);
?>
echo(log(2.7183) . "<br>");
echo(log(2) . "<br>");
echo(log(1) . "<br>");
echo(log(0);
?>
Running instance »
Definition and Usage
log () function returns the number of the natural logarithm of a number, or a number to the base for the bottom of.
grammar
log( number,base );
参数 | 描述 |
---|---|
number | 必需。规定需计算对数的值。 |
base | 可选。要使用的对数的底。默认是 'e'。 |
technical details
return value: | Logarithm natural logarithm of a number, or a number to the base for the bottom of. |
---|---|
Return type: | Float |
PHP version: | 4+ |
PHP Update Log: | PHP 4.3: new base parameters. |
PHP Math Reference