PHP/Math/log
calculate logarithms by dividing log() function with log(base)
<?php
$val = 100;
$i = log($val);
echo "log($val) = $i\n";
$i10 = log($val) / log(10);
echo "log($val) / log(10) = $i10\n";
$i10 = log10($val);
echo "log10($val) = $i10\n";
?>
Calculate logarithms with other base values by dividing the result of the log() function with log(base).
<?php
$val = 100;
$i = log($val);
echo "log($val) = $i\n";
$i10 = log($val) / log(10);
echo "log($val) / log(10) = $i10\n";
$i10 = log10($val);
echo "log10($val) = $i10\n";
?>
Calculation of e, the inverse nature of exp and log
<?php
$e = exp(1);
echo "$e\n";
$i = log($e);
echo "$i\n";
?>