How To Calculate Log Of a Number

Submitted on: 5/5/2018 7:20:06 PM
By: Gaurav Singh  
Level: Intermediate
User Rating: Unrated
Compatibility: PHP 3.0, PHP 4.0, PHP 5.0
Views: 11045
     How to find Logarithm of Number to the base N in PHP.


The logarithm is the inverse function to exponentiation.

In by = x, Then base b logarithm of a number X is given by logbX.

The logarithm to base 10 when base b = 10, is called the common logarithm and The natural logarithm when base b = e (≈ 2.718).

To find log in PHP we have a direct log function : log(number, base). For example if we have to find a log of 125 to base 3, just call log function with log(125, 3) .

Use this example Log X calculator to calculate Logarithm of a Number.

Other 1 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.