Return the natural logarithm of distinct numbers:
<?phpecho(log(2.7183) . "<br>");echo(log(2) . "<br>");echo(log(1) . "<br>");echo(log(0) ;?>The log() function returns the natural logarithm of a number, or the base logarithm of a number.
log( number,base );
parameter | describe |
---|---|
number | Required. Specifies the value of the logarithm to be calculated. |
base | Optional. The base of the logarithm to use. The default is 'e'. |
Return value: | The natural logarithm of a number, or the base logarithm of a number . |
---|---|
Return type: | Float |
PHP version: | 4+ |
PHP change log: | PHP 4.3: Added base parameter. |