PHP log

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : log() function

Description

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

Version

(PHP 4 and above)

Syntax

log(number,nbase)

Parameter

Name

Description

Required /
Optional

Type

number

The value to calculate the logarithm.

Required

Float

nbase

The base to use. Default is 'e'.

Optional

Float

Return value

The logarithm of number to nbase, if given, or the natural logarithm.

Value Type : Float.

Example :

  1. echo(log(2) . "
    ");  

  2. echo(log(1.234) . "
    ");  

  3. echo(log(0) . "
    ");  

  4. echo(log(1) . "
    ");  

  5. ?>  

Output :

0.69314718056
0.210260925483
-INF
0