<HTML ><HEAD ><TITLE >bcpowmod</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="BCMath Arbitrary Precision Mathematics Functions" 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=ISO-8859-1"></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 Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.bcpow.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.bcscale.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.bcpowmod" ></A >bcpowmod</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN9700" ></A ><P > (PHP 5 CVS only)</P >bcpowmod -- Raise an arbitrary precision number to another, reduced by a specified modulus. </DIV ><DIV CLASS="refsect1" ><A NAME="AEN9703" ></A ><H2 >Description</H2 >string <B CLASS="methodname" >bcpowmod</B > ( string x, string y, string modulus [, int scale])<BR ></BR ><P > Use the fast-exponentiation method to raise <TT CLASS="parameter" ><I >x</I ></TT > to the power <TT CLASS="parameter" ><I >y</I ></TT > with respect to the modulus <TT CLASS="parameter" ><I >modulus</I ></TT >. The optional <TT CLASS="parameter" ><I >scale</I ></TT > can be used to set the number of digits after the decimal place in the result. </P ><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" ><A NAME="AEN9727" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php $a = bcpowmod($x,$y,$mod); $b = bcmod(bcpow($x,$y),$mod); /* $a and $b are equal to each other. */ ?></PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >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. </P ></BLOCKQUOTE ></DIV > </P ><P > See also <A HREF="function.bcpow.html" ><B CLASS="function" >bcpow()</B ></A >, and <A HREF="function.bcmod.html" ><B CLASS="function" >bcmod()</B ></A >. </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" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.bcscale.html" ACCESSKEY="N" >Next</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" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >bcscale</TD ></TR ></TABLE ></DIV ></BODY ></HTML >