log
Description
Syntax
log(
float $num,
float $base = M_E
): floatParameters
num
The value to calculate the logarithm for.
base
The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm).
Return
Returns the logarithm of num to base, if given, or the natural logarithm.
Examples
1 · num
<? $num = 12.34; $return = log($num); echo $return;
2.5128460184772
2 · base · M_E
<? $num = 12.34; $base = M_E; $return = log($num, $base); echo $return;
2.5128460184772
3 · base · 2
<? $num = 12.34; $base = 2; $return = log($num, $base); echo $return;
3.6252704893747
4 · base · 10
<? $num = 12.34; $base = 10; $return = log($num, $base); echo $return;
1.0913151596972