HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

log

Description

The log of Math for PHP natural logarithm.

Syntax

log(
    float $num,
    float $base = M_E
): float

Parameters

num

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 num to base, if given, or the natural logarithm.

Examples

1 · num

<?

$num = 12.34;

$return = log($num);

echo $return;
2.5128460184772

2 · base

<?

$num = 12.34;
$base = 2;

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

echo $return;
3.6252704893747