<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >bcpowmod</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="BC math 高精度数学函数" HREF="ref.bc.html"><LINK REL="PREVIOUS" TITLE="bcpow" HREF="function.bcpow.html"><LINK REL="NEXT" TITLE="bcscale" HREF="function.bcscale.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.bcpow.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.bcscale.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.bcpowmod" ></A >bcpowmod</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN14323" ></A ><P > (PHP 5)</P >bcpowmod -- Raise an arbitrary precision number to another, reduced by a specified modulus</DIV ><DIV CLASS="refsect1" ><A NAME="AEN14326" ></A ><H2 >说明</H2 >string <B CLASS="methodname" >bcpowmod</B > ( string left_operand, string right_operand, string modulus [, int scale] )<BR ></BR ><P > Use the fast-exponentiation method to raise <CODE CLASS="parameter" >left_operand</CODE > to the power <CODE CLASS="parameter" >right_operand</CODE > with respect to the modulus <CODE CLASS="parameter" >modulus</CODE >. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN14347" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >left_operand</CODE ></DT ><DD ><P > The left operand, as a string. </P ></DD ><DT ><CODE CLASS="parameter" >right_operand</CODE ></DT ><DD ><P > The right operand, as a string. </P ></DD ><DT ><CODE CLASS="parameter" >modulus</CODE ></DT ><DD ><P > The modulus, as a string. </P ></DD ><DT ><CODE CLASS="parameter" > scale</CODE ></DT ><DD ><P >This optional parameter is used to set the number of digits after the decimal place in the result. You can also set the global default scale for all functions by using <A HREF="function.bcscale.html" ><B CLASS="function" >bcscale()</B ></A >.</P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN14372" ></A ><H2 >返回值</H2 ><P > Returns the result as a string, or <TT CLASS="constant" ><B >NULL</B ></TT > if <CODE CLASS="parameter" >modulus</CODE > is 0. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN14377" ></A ><H2 >注释</H2 ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > Because this method uses the modulus operation, non-natural numbers may give unexpected results. A natural number is any positive non-zero integer. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN14381" ></A ><H2 >范例</H2 ><P > The following two statements are functionally identical. The <B CLASS="function" >bcpowmod()</B > version however, executes in less time and can accept larger parameters. <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN14385" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$a </font><font color="#007700">= </font><font color="#0000BB">bcpowmod</font><font color="#007700">(</font><font color="#0000BB">$x</font><font color="#007700">, </font><font color="#0000BB">$y</font><font color="#007700">, </font><font color="#0000BB">$mod</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$b </font><font color="#007700">= </font><font color="#0000BB">bcmod</font><font color="#007700">(</font><font color="#0000BB">bcpow</font><font color="#007700">(</font><font color="#0000BB">$x</font><font color="#007700">, </font><font color="#0000BB">$y</font><font color="#007700">), </font><font color="#0000BB">$mod</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// $a and $b are equal to each other.<br /><br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN14387" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.bcpow.html" ><B CLASS="function" >bcpow()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.bcmod.html" ><B CLASS="function" >bcmod()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.bcpow.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.bcscale.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >bcpow</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.bc.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >bcscale</TD ></TR ></TABLE ></DIV ></BODY ></HTML >