log

Natural logarithm

Syntax

log ( float $arg [, float $base = M_E ] ) : float

Parameters

arg

The value to calculate the logarithm for

base

The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm).

Return

The logarithm of arg to base, if given, or the natural logarithm.

Examples

1 · arg

<?

$arg = 12.34;

$return = log($arg);

echo $return;

?>
2.5128460184772

2 · base

<?

$arg = 12.34;
$base = 2;

$return = log($arg, $base);

echo $return;

?>
3.6252704893747
HomeMenu