PHP log() - Math Functions

What is log Function?

Explanation

The "log()" function returns the natural logarithm of a number.

Syntax:


log(x,base)

In the above syntax "x" is the number for which to find the natural logarithm, "base" is an optional value.

Example:>

<?php
echo(log(2.7183)."<br />");
echo(log(-1));
?>
Result :

1.00000668491
NAN

In the above example the negative value returns NAN value.

PHP Topics


Ask Questions

Ask Question