This function calculates the logarithm of a number. Basically, the logarithm is the inverse of exponents [see pow()].

For example,
82 = 64
log8(64) = 2
That’s said as “the log of 64 base 8 is 2″.

By default this function calculates the natural log, but you may specify the base in the second parameter. Attempting to calculate the log of a negative number will result in the special value of “NAN” (Not A Number).

$l = log(17);     // 2.83321334406
$l = log(17, 10); // 1.23044892138
$l = log(M_PI);   // 1.14472988585
$l = log(1);      // 0
$l = log(0);      // -INF
$l = log(-4);     // NAN