<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/ref.math.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.log.php', 1 => 'log', ), 'up' => array ( 0 => 'ref.math.php', 1 => 'Math Functions', ), 'prev' => array ( 0 => 'function.is-nan.php', 1 => 'is_nan', ), 'next' => array ( 0 => 'function.log10.php', 1 => 'log10', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/math/functions/log.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="function.log" class="refentry"> <div class="refnamediv"> <h1 class="refname">log</h1> <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">log</span> — <span class="dc-title">Natural logarithm</span></p> </div> <div class="refsect1 description" id="refsect1-function.log-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="methodname"><strong>log</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$base</code><span class="initializer"> = <strong><code><a href="math.constants.php#constant.m-e">M_E</a></code></strong></span></span>): <span class="type"><a href="language.types.float.php" class="type float">float</a></span></div> <p class="para rdfs-comment"> If the optional <code class="parameter">base</code> parameter is specified, <span class="function"><strong>log()</strong></span> returns log<sub class="subscript">base</sub> <code class="parameter">num</code>, otherwise <span class="function"><strong>log()</strong></span> returns the natural logarithm of <code class="parameter">num</code>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.log-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt><code class="parameter">num</code></dt> <dd> <p class="para"> The value to calculate the logarithm for </p> </dd> <dt><code class="parameter">base</code></dt> <dd> <p class="para"> The optional logarithmic base to use (defaults to 'e' and so to the natural logarithm). </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.log-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The logarithm of <code class="parameter">num</code> to <code class="parameter">base</code>, if given, or the natural logarithm. </p> </div> <div class="refsect1 seealso" id="refsect1-function.log-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li><span class="function"><a href="function.log10.php" class="function" rel="rdfs-seeAlso">log10()</a> - Base-10 logarithm</span></li> <li><span class="function"><a href="function.exp.php" class="function" rel="rdfs-seeAlso">exp()</a> - Calculates the exponent of e</span></li> <li><span class="function"><a href="function.pow.php" class="function" rel="rdfs-seeAlso">pow()</a> - Exponential expression</span></li> <li><span class="function"><a href="function.error-log.php" class="function" rel="rdfs-seeAlso">error_log()</a> - Send an error message to the defined error handling routines</span></li> </ul> </p> </div> </div><?php manual_footer($setup); ?>