<?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.pow.php',
    1 => 'pow',
    2 => 'Exponential expression',
  ),
  'up' => 
  array (
    0 => 'ref.math.php',
    1 => 'Math Functions',
  ),
  'prev' => 
  array (
    0 => 'function.pi.php',
    1 => 'pi',
  ),
  'next' => 
  array (
    0 => 'function.rad2deg.php',
    1 => 'rad2deg',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/math/functions/pow.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pow" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pow</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pow</span> &mdash; <span class="dc-title">Exponential expression</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.pow-description">
  <h3 class="title">Description</h3>
   <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pow</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$exponent</code></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.float.php" class="type float">float</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></div>

  <p class="para rdfs-comment">
   Returns <code class="parameter">num</code> raised to the power of
   <code class="parameter">exponent</code>. 
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    It is possible to use the <a href="language.operators.arithmetic.php" class="link">**</a> operator instead.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.pow-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">num</code></dt>
     <dd>
      <p class="para">
       The base to use
      </p>
     </dd>
    
    
     <dt><code class="parameter">exponent</code></dt>
     <dd>
      <p class="para">
       The exponent
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.pow-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   <code class="parameter">num</code> raised to the power of <code class="parameter">exponent</code>.
   If both arguments are non-negative integers and the result can be represented
   as an integer, the result will be returned with <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> type,
   otherwise it will be returned as a <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
  </p>
  <p class="para">
   PHP-Extensions may override the behaviour of this operation and make it return an object.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pow-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       Raising <code class="literal">0</code> to a negative
       <code class="parameter">exponent</code> is now deprecated.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.pow-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Some examples of <span class="function"><strong>pow()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pow</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">8</span><span style="color: #007700">)); </span><span style="color: #FF8000">// int(256)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">pow</span><span style="color: #007700">(-</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// 1<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">pow</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// 1<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">pow</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">, -</span><span style="color: #0000BB">1</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// 0.1<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">pow</span><span style="color: #007700">(-</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">5.5</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// NAN<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Example #2 Examples of <span class="function"><strong>pow()</strong></span> With GMP Extension Object</strong></p>
    <div class="example-contents">
<div class="annotation-non-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pow</span><span style="color: #007700">(new </span><span style="color: #0000BB">GMP</span><span style="color: #007700">(</span><span style="color: #DD0000">"3"</span><span style="color: #007700">), new </span><span style="color: #0000BB">GMP</span><span style="color: #007700">(</span><span style="color: #DD0000">"2"</span><span style="color: #007700">))); </span><span style="color: #FF8000">// object(GMP)<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.pow-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function will convert all input to a number, even non-scalar values,
    which could lead to <em>weird</em> results.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pow-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li>
     Exponentiation operator
     <a href="language.operators.arithmetic.php" class="link"><code class="literal">**</code></a>
    </li>
    <li><span class="function"><a href="function.fpow.php" class="function" rel="rdfs-seeAlso">fpow()</a> - Raise one number to the power of another, according to IEEE 754</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.sqrt.php" class="function" rel="rdfs-seeAlso">sqrt()</a> - Square root</span></li>
    <li><span class="function"><a href="function.bcpow.php" class="function" rel="rdfs-seeAlso">bcpow()</a> - Raise an arbitrary precision number to another</span></li>
    <li><span class="function"><a href="function.gmp-pow.php" class="function" rel="rdfs-seeAlso">gmp_pow()</a> - Raise number into power</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>