Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 3622

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the floating point remainder (modulo) of the division
  of the arguments</title>

 </head>
 <body><div class="manualnavbar" 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 &gt;= 4.2.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">fmod</span> &mdash; <span class="dc-title">Returns the floating point remainder (modulo) of the division
  of the arguments</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.fmod-description">
  <h3 class="title">Description</h3>
   <div class="methodsynopsis dc-description">
    <span class="type">float</span> <span class="methodname"><strong>fmod</strong></span>
     ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$x</code></span>
    , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y</code></span>
    )</div>

  <p class="para rdfs-comment">
   Returns the floating point remainder of dividing the dividend
   (<code class="parameter">x</code>) by the divisor (<code class="parameter">y</code>).
   The remainder (<var class="varname"><var class="varname">r</var></var>) is defined as: x = i * y + r, for 
   some integer <var class="varname"><var class="varname">i</var></var>. If <code class="parameter">y</code> is
   non-zero, <var class="varname"><var class="varname">r</var></var> has the same sign as
   <code class="parameter">x</code> and a magnitude less than the magnitude of
   <code class="parameter">y</code>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.fmod-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">x</code></dt>

     <dd>

      <p class="para">
       The dividend
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">y</code></dt>

     <dd>

      <p class="para">
       The divisor
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.fmod-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The floating point remainder of 
   <code class="parameter">x</code>/<code class="parameter">y</code>
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.fmod-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4256">
    <p><strong>Example #1 Using <span class="function"><strong>fmod()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">5.7</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1.3</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fmod</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">);<br /></span><span style="color: #FF8000">//&nbsp;$r&nbsp;equals&nbsp;0.5,&nbsp;because&nbsp;4&nbsp;*&nbsp;1.3&nbsp;+&nbsp;0.5&nbsp;=&nbsp;5.7<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

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

 <div class="refsect1 seealso" id="refsect1-function.fmod-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="language.operators.arithmetic.html" class="link"><em>/</em></a> - Floating-point division</li>
    <li class="member"><a href="language.operators.arithmetic.html" class="link"><em>%</em></a> - Integer modulus</li>
    <li class="member"><span class="function"><a href="function.intdiv.html" class="function">intdiv()</a></span> - Integer division</li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" 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>