📄 function.fmod.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns the floating point remainder (modulo) of the division of the arguments</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.floor.html">floor</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.getrandmax.html">getrandmax</a></div> <div class="up"><a href="ref.math.html">Math Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.fmod" class="refentry"> <div class="refnamediv"> <h1 class="refname">fmod</h1> <p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">fmod</span> — <span class="dc-title">Returns the floating point remainder (modulo) of the division of the arguments</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">float</span> <span class="methodname"><b><b>fmod</b></b></span> ( <span class="methodparam"><span class="type">float</span> <tt class="parameter">$x</tt></span> , <span class="methodparam"><span class="type">float</span> <tt class="parameter">$y</tt></span> )</div> <p class="para rdfs-comment"> Returns the floating point remainder of dividing the dividend (<i><tt class="parameter">x</tt></i>) by the divisor (<i><tt class="parameter">y</tt></i>). The reminder (<var class="varname">r</var>) is defined as: x = i * y + r, for some integer <var class="varname">i</var>. If <i><tt class="parameter">y</tt></i> is non-zero, <var class="varname">r</var> has the same sign as <i><tt class="parameter">x</tt></i> and a magnitude less than the magnitude of <i><tt class="parameter">y</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">x</tt></i></span> <dd> <p class="para"> The dividend </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">y</tt></i></span> <dd> <p class="para"> The divisor </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The floating point remainder of <i><tt class="parameter">x</tt></i>/<i><tt class="parameter">y</tt></i> </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 Using <b>fmod()</b></b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$x </span><span style="color: #007700">= </span><span style="color: #0000BB">5.7</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">1.3</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$r </span><span style="color: #007700">= </span><span style="color: #0000BB">fmod</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">, </span><span style="color: #0000BB">$y</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.floor.html">floor</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.getrandmax.html">getrandmax</a></div> <div class="up"><a href="ref.math.html">Math Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -