<!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.splminheap.html">SplMinHeap</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.splpriorityqueue.html">SplPriorityQueue</a></div> <div class="up"><a href="class.splminheap.html">SplMinHeap</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="splminheap.compare" class="refentry"> <div class="refnamediv"> <h1 class="refname">SplMinHeap::compare</h1> <p class="verinfo">(PHP 5 >= 5.3.0)</p><p class="refpurpose"><span class="refname">SplMinHeap::compare</span> — <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-splminheap.compare-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">protected</span> <span class="type">int</span> <span class="methodname"><strong>SplMinHeap::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> <div class="refsect1 parameters" id="refsect1-splminheap.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-splminheap.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 lower 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.splminheap.html">SplMinHeap</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.splpriorityqueue.html">SplPriorityQueue</a></div> <div class="up"><a href="class.splminheap.html">SplMinHeap</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>