English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

log() function in PHP

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

Syntax

log(num, base)

Parameter

  • num-The value to calculate the logarithm for

  • Base-Logarithm Base

Return

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

Example

<?php
   echo(log(1));
?>

Output Result

0

Example

Let's look at another example-

<?php
   echo(log(0));
?>

Output Result

-INF

Example

Let's look at another example-

<?php
   echo(log(10));
   echo(log(2.7));
?>

Output Result

2.3025850929940.99325177301028