Javatpoint Logo
Javatpoint Logo

PHP log() function

The log() function is inbuilt php function, which is used to find the natural logarithm of a number or the logarithm of number to base.

Syntax:

Parameter Description Required /Optional
number Specify the value to calculate the logarithm. Required
base base to use but default is 'e' Optional

Note: We get output as LOG of X if the input number with Base Y (optional) .

Example1

Output:

Your number is: 2
By using log() function your number is : 0.69314718055995

Example2

Output:

Your number is: 2.7183
By using log() function your number is : 1.000006684914

Example3

Output:

Your number is: -1
By using log() function your number is : NAN

Example4

Output:

Your number is: 0
By using log() function your number is : -INF

Note: Example of LOG() with Base.

Example5

Output:

Your number is: log(5,2) 
By using log() function your number is : 2.3219280948874

Example6

Output:

Your number is: log(5,10) 
By using log() function your number is : 0.69897000433602

Example7

Output:

Your number is: log(5,2.7183) 
By using log() function your number is : 1.609427153552

Next TopicPHP Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA