log

Natural logarithm

Syntax

log ( float $arg [, float $base = M_E ] ) : float

Parameters

arg

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

Examples

1 · arg

<?

$arg = 12.34;

$return = log($arg);

echo $return;

?>
2.5128460184772

2 · base

<?

$arg = 12.34;
$base = 2;

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

echo $return;

?>
3.6252704893747

abs

acos

acosh

asin

asinh

atan

atan2

atanh

base_convert

bindec

ceil

cos

cosh

decbin

dechex

decoct

deg2rad

exp

expm1

fdiv

floor

fmod

hexdec

hypot

intdiv

is_finite

is_infinite

is_nan

log10

log1p

max

min

octdec

pi

pow

rad2deg

round

sin

sinh

sqrt

tan

tanh

PHP

Home Menu