Calculate logarithms with other base values by dividing the result of the log() function with log(base). : log « Math « PHP






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";
?>
  
  








Related examples in the same category

1.Calculation of e, the inverse nature of exp and log
2.calculate logarithms by dividing log() function with log(base)