Home > PHP > Function > Math > log()

log()

log - Natural logarithm

Syntax

float log (float $arg, float $base)

Arguments

  • arg - The value to calculate the logarithm for
  • base - The optional logarithmic base to use (defaults to \'e\' and so to the natural logarithm).

Description

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

Version

PHP 4, 5

Return value

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