PHP log() functionLast Updated : 17 Mar 2025 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:
Note: We get output as LOG of X if the input number with Base Y (optional) .Example1Output: Your number is: 2 By using log() function your number is : 0.69314718055995 Example2Output: Your number is: 2.7183 By using log() function your number is : 1.000006684914 Example3Output: Your number is: -1 By using log() function your number is : NAN Example4Output: Your number is: 0 By using log() function your number is : -INF Note: Example of LOG() with Base.Example5Output: Your number is: log(5,2) By using log() function your number is : 2.3219280948874 Example6Output: Your number is: log(5,10) By using log() function your number is : 0.69897000433602 Example7Output: Your number is: log(5,2.7183) By using log() function your number is : 1.609427153552 Next TopicPhp math mt rand function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India