log

float log(float num) 

Calculates the natural logarithm of a number.

Returns:

Natural logarithm of a number

Description:

Calculates the natural logarithm of the number given by num . log() is the opposite of the exp() function.

Version:

PHP 3, PHP 4

See also:

exp() 
log10() 

Example:

Calculate the natural logarithm of a number
$num = 54.5981; 
echo "The natural log of $num is ",log($num),"\n"; 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.