log()


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

Description

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

※ available F/W version : all

Parameters

Return values

Returns the logarithm of $arg to $base if given, or the natural logarithm

Example

<?php
$f1 = log(2);  // logarithmic base: ‘e’
$f2 = log(2, 10);

echo "f1 = $f1\r\n";  // OUTPUT: f1 = 0.69314718055995
echo "f2 = $f2\r\n";  // OUTPUT: f2 = 0.30102999566398
?>

See also

exp()

Remarks

This function is identical to the PHP group’s log() function.