function.bcpowmod.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 161 行

HTML
161
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Raise an arbitrary precision number to another, reduced by a specified modulus</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.bcpow.html">bcpow</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.bcscale.html">bcscale</a></div> <div class="up"><a href="ref.bc.html">BC Math Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.bcpowmod" class="refentry"> <div class="refnamediv">  <h1 class="refname">bcpowmod</h1>  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">bcpowmod</span> &mdash; <span class="dc-title">Raise an arbitrary precision number to another, reduced by a specified modulus</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">string</span> <span class="methodname"><b><b>bcpowmod</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$left_operand</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$right_operand</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$modulus</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$scale</tt></span>  ] )</div>  <p class="para rdfs-comment">   Use the fast-exponentiation method to raise    <i><tt class="parameter">left_operand</tt></i> to the power   <i><tt class="parameter">right_operand</tt></i> with respect to the modulus   <i><tt class="parameter">modulus</tt></i>.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">left_operand</tt></i></span>     <dd>      <p class="para">       The left operand, as a string.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">right_operand</tt></i></span>     <dd>      <p class="para">       The right operand, as a string.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">modulus</tt></i></span>     <dd>      <p class="para">       The modulus, as a string.      </p>     </dd>    </dt>    <dt><span class="term"><i><tt class="parameter">scale</tt></i></span><dd><p class="para">This optional parameter is used to set the numberof digits after the decimal place in the result. You can also set the global default scalefor all functions by using <a href="function.bcscale.html" class="function">bcscale()</a>.</p></dd></dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns the result as a string, or <b><tt>NULL</tt></b> if <i><tt class="parameter">modulus</tt></i>   is 0.  </p> </div>  <div class="refsect1 notes">  <h3 class="title">Notes</h3>  <blockquote><p><b class="note">Note</b>:        Because this method uses the modulus operation, non-natural numbers    may give unexpected results.  A natural number is any positive    non-zero integer.   <br />  </p></blockquote> </div>  <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   The following two statements are functionally identical.  The   <b>bcpowmod()</b> version however, executes in   less time and can accept larger parameters.   <div class="informalexample">    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">bcpowmod</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$mod</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">bcmod</span><span style="color: #007700">(</span><span style="color: #0000BB">bcpow</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">$mod</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;$a&nbsp;and&nbsp;$b&nbsp;are&nbsp;equal&nbsp;to&nbsp;each&nbsp;other.<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div>  <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.bcpow.html" class="function" rel="rdfs-seeAlso">bcpow()</a></li>    <li class="member"><a href="function.bcmod.html" class="function" rel="rdfs-seeAlso">bcmod()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.bcpow.html">bcpow</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.bcscale.html">bcscale</a></div> <div class="up"><a href="ref.bc.html">BC Math Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?