PHP log() function

Definition and Usage

log() returns the natural logarithm.

Syntax

log(x,base)
Parameter Description
x Required. A number.
base Optional. If the parameter is specified, it returns logbasex.

Description

If the optional parameter is specified base, log() returns logbasex, otherwise log() returns the parameter x of the natural logarithm.

Note:The parameter base has been available since PHP 4.3.0. You can calculate the logarithm of any number n with base b, but actually it uses the mathematical formula: logb(n) = log(n)/log(b), where log is the natural logarithm.

Example

<?php
echo lcg_value();
?>

Output similar to:

0.508212039328