<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.bc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.bccomp.php',
    1 => 'bccomp',
    2 => 'Vergleich zweier Zahlen beliebiger Genauigkeit',
  ),
  'up' => 
  array (
    0 => 'ref.bc.php',
    1 => 'BC Math Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.bcceil.php',
    1 => 'bcceil',
  ),
  'next' => 
  array (
    0 => 'function.bcdiv.php',
    1 => 'bcdiv',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/bc/functions/bccomp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.bccomp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">bccomp</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">bccomp</span> &mdash; <span class="dc-title">Vergleich zweier Zahlen beliebiger Genauigkeit</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.bccomp-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>bccomp</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$num1</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$num2</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Vergleicht <code class="parameter">num1</code> mit <code class="parameter">num2</code>
   und gibt das Ergebnis als Integer-Wert zurück.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.bccomp-parameters">
  <h3 class="title">Parameter-Liste</h3><p class="para">
   <dl>
    
     <dt><code class="parameter">num1</code></dt>
     <dd>
      <p class="para">
       Der linke Operand als Zeichenkette.
      </p>
     </dd>
    
    
     <dt><code class="parameter">num2</code></dt>
     <dd>
      <p class="para">
       Der rechte Operand als Zeichenkette.
      </p>
     </dd>
    
    
     <dt><code class="parameter">scale</code></dt>
     <dd>
      <span class="simpara">
       Dieser Parameter wird verwendet, um die Anzahl der Nachkommastellen im
       Ergebnis festzulegen.
       Falls <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, wird die mit <span class="function"><a href="function.bcscale.php" class="function">bcscale()</a></span> definierte
       Standard-Genauigkeit verwendet oder auf den Wert der INI-Direktive
       <a href="bc.configuration.php#ini.bcmath.scale" class="link"><code class="literal">bcmath.scale</code></a>
       zurückgegriffen.
      </span>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.bccomp-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Gibt <code class="literal">0</code> zurück, wenn beide Operatoren gleich sind,
   <code class="literal">1</code>, wenn <code class="parameter">num1</code> größer ist als
   <code class="parameter">num2</code>, und andernfalls <code class="literal">-1</code>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.bccomp-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Diese Funktion löst in den folgenden Fällen einen
   <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> aus:
   <ul class="simplelist">
    <li>
     <code class="parameter">num1</code> oder <code class="parameter">num2</code>
     ist keine wohlgeformte numerische BCMath-Zeichenkette.
    </li>
    <li>
     <code class="parameter">scale</code> liegt außerhalb des gültigen Bereichs.
    </li>
   </ul>
  </p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">scale</code> ist jetzt nullbar.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.bccomp-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>bccomp()</strong></span>-Beispiel</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: #007700">echo </span><span style="color: #0000BB">bccomp</span><span style="color: #007700">(</span><span style="color: #DD0000">'1'</span><span style="color: #007700">, </span><span style="color: #DD0000">'2'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;   </span><span style="color: #FF8000">// -1<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">bccomp</span><span style="color: #007700">(</span><span style="color: #DD0000">'1.00001'</span><span style="color: #007700">, </span><span style="color: #DD0000">'1'</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">); </span><span style="color: #FF8000">// 0<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">bccomp</span><span style="color: #007700">(</span><span style="color: #DD0000">'1.00001'</span><span style="color: #007700">, </span><span style="color: #DD0000">'1'</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">); </span><span style="color: #FF8000">// 1<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.bccomp-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="bcmath-number.compare.php" class="methodname" rel="rdfs-seeAlso">BcMath\Number::compare()</a> - Compares two arbitrary precision numbers</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>