Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 11855

php-manual-en-5.5.7-1.mga4.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>Compare elements in order to place them correctly in the heap while sifting up.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.splheap.html">SplHeap</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splheap.construct.html">SplHeap::__construct</a></div>
 <div class="up"><a href="class.splheap.html">SplHeap</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="splheap.compare" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplHeap::compare</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0)</p><p class="refpurpose"><span class="refname">SplHeap::compare</span> &mdash; <span class="dc-title">Compare elements in order to place them correctly in the heap while sifting up.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-splheap.compare-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span> <span class="modifier">protected</span> <span class="type">int</span> <span class="methodname"><strong>SplHeap::compare</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value1</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value2</code></span>
   )</div>


  <p class="para rdfs-comment">
   Compare <em><code class="parameter">value1</code></em> with <em><code class="parameter">value2</code></em>.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    Throwing exceptions in  <span class="methodname"><strong>SplHeap::compare()</strong></span> can
    corrupt the Heap and place it in a blocked state. You can unblock it by
    calling  <span class="methodname"><a href="splheap.recoverfromcorruption.html" class="methodname">SplHeap::recoverFromCorruption()</a></span>. 
    However, some elements might not be placed correctly and it may hence
    break the heap-property.
   </p>
  </div>
 </div>


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

    <dt>

     <span class="term"><em><code class="parameter">value1</code></em></span>
     <dd>

      <p class="para">
       The value of the first node being compared.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">value2</code></em></span>
     <dd>

      <p class="para">
       The value of the second node being compared.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splheap.compare-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Result of the comparison, positive integer if <em><code class="parameter">value1</code></em> is greater than <em><code class="parameter">value2</code></em>, 0 if they are equal, negative integer otherwise.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position.
   </p>
  </p></blockquote>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.splheap.html">SplHeap</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splheap.construct.html">SplHeap::__construct</a></div>
 <div class="up"><a href="class.splheap.html">SplHeap</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>