X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP log() Function

PHP Math Reference PHP Math Reference

Example

Return the natural logarithm of different numbers:

<?php
echo(log(2.7183) . "<br>");
echo(log(2) . "<br>");
echo(log(1) . "<br>");
echo(log(0);
?>

Run example »

Definition and Usage

The log() function returns the natural logarithm of a number, or the logarithm of number to base.


Syntax

log(number,base);

Parameter Description
number Required. Specifies the value to calculate the logarithm for
base Optional. The logarithmic base to use. Default is 'e'

Technical Details

Return Value: The natural logarithm of a number, or the logarithm of number to base
Return Type: Float
PHP Version: 4+
PHP Changelog: PHP 4.3: The base parameter were added


PHP Math Reference PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook