Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 2664

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>Set default scale parameter for all bc math functions</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.bcpowmod.html">bcpowmod</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.bcsqrt.html">bcsqrt</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.bcscale" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">bcscale</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">bcscale</span> &mdash; <span class="dc-title">Set default scale parameter for all bc math functions</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.bcscale-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>bcscale</strong></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$scale</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Sets the default scale parameter for all subsequent calls to bc math functions that
   do not explicitly specify a scale parameter.
   If <code class="parameter">scale</code> is omitted, the function gets the current
   scale factor.
  </p>
 </div>


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

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

     <dd>

      <p class="para">
       The scale factor.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.bcscale-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the old scale.
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.bcscale-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.3.0</td>
      <td>
       <span class="function"><strong>bcscale()</strong></span> can now be used to get the current scale
       factor; when used as setter, it now returns the old scale value.
       Formerly, <code class="parameter">scale</code> was mandatory, and
       <span class="function"><strong>bcscale()</strong></span> always returned <strong><code>TRUE</code></strong>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.bcscale-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4186">
    <p><strong>Example #1 <span class="function"><strong>bcscale()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;default&nbsp;scale&nbsp;:&nbsp;3<br /></span><span style="color: #0000BB">bcscale</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">bcdiv</span><span style="color: #007700">(</span><span style="color: #DD0000">'105'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'6.55957'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;16.007<br /><br />//&nbsp;this&nbsp;is&nbsp;the&nbsp;same&nbsp;without&nbsp;bcscale()<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">bcdiv</span><span style="color: #007700">(</span><span style="color: #DD0000">'105'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'6.55957'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;16.007<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

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

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.bcpowmod.html">bcpowmod</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.bcsqrt.html">bcsqrt</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>