To find the natural logarithm of a number in PHP, you can use the log()
function with the constant M_E
as the second parameter. The M_E
constant represents the mathematical constant "e", which is the base of the natural logarithm.
Here's an example code snippet:
main.php78 chars4 lines
This will output:
main.php46 chars2 lines
You can also use the shorthand log()
function without specifying the base parameter, which will default to the natural logarithm:
main.php73 chars4 lines
This will output the same result.
gistlibby LogSnag