PHP log() Function
Example
Return the natural logarithm of different numbers:
"); echo(log(2) . ""); echo(log(1) . "
"); echo(log(0); ?>
Run Example »
Definition and Usage
The log() function returns the natural logarithm of a number, or the logarithm to base base of number .
Syntax
log(
number,base
);
| Parameters | Description |
|---|---|
| number | Required. Specifies the value whose logarithm is to be calculated. |
| base | Optional. The base of the logarithm to use. Default is 'e'. |
Technical Details
| Return Value: | The natural logarithm of a number, or the logarithm to base base of number . |
|---|---|
| Return Type: | Float |
| PHP Version: | 4+ |
| PHP Changelog: | PHP 4.3: The base parameter was added. |
PHP Math Reference Manual