← All built-ins / log()

log()

log(mixed $number): float

Parameters

NameTypeDescription
$numberfloat|intpositive input
$basefloat|intlogarithm base (default e)optional

Return value

Natural logarithm, or base-$base logarithm.

Example

echo round(log(M_E), 3), " ", round(log(8, 2), 4);
1 3

See also

log2()log10()exp()