<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.ds-set.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'ds-set.sorted.php',
    1 => 'Ds\\Set::sorted',
    2 => 'Returns a sorted copy',
  ),
  'up' => 
  array (
    0 => 'class.ds-set.php',
    1 => 'Ds\\Set',
  ),
  'prev' => 
  array (
    0 => 'ds-set.sort.php',
    1 => 'Ds\\Set::sort',
  ),
  'next' => 
  array (
    0 => 'ds-set.sum.php',
    1 => 'Ds\\Set::sum',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ds/ds/set/sorted.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ds-set.sorted" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ds\Set::sorted</h1>
  <p class="verinfo">(PECL ds &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Set::sorted</span> &mdash; <span class="dc-title">Returns a sorted copy</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ds-set.sorted-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Ds\Set::sorted</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$comparator</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="class.ds-set.php" class="type Ds\Set">Ds\Set</a></span></div>

  <p class="para rdfs-comment">
    Returns a sorted copy, using an optional <code class="parameter">comparator</code> function.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-ds-set.sorted-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
     <dt><code class="parameter">comparator</code></dt>
     <dd>
      <p class="para">
 Die Vergleichsfunktion muss einen Integer kleiner als, gleich oder größer als Null zurückgeben, wenn das erste Argument respektive kleiner, gleich oder größer als das zweite ist.
</p>
<div class="methodsynopsis dc-description"><span class="methodname"><span class="replaceable">callback</span></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$a</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$b</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

<div class="caution"><strong class="caution">Achtung</strong>
 <p class="para">
  Wenn die Vergleichsfunktion <em>nicht-ganzzahlige</em> Werte
  zurückgibt, z. B. vom Typ <span class="type"><a href="language.types.float.php" class="type float">float</a></span>, wird der Rückgabewert des
  Callbacks intern in den Typ <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> umgewandelt. Werte wie
  <code class="literal">0.99</code> und <code class="literal">0.1</code> werden also beide in
  einen Integer-Wert von <code class="literal">0</code> umgewandelt, wodurch diese Werte
  als gleichwertig eingestuft werden.
 </p>
</div>
     </dd>
    
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-ds-set.sorted-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
    Returns a sorted copy of the set.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-ds-set.sorted-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>Ds\Set::sorted()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$set </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Set</span><span style="color: #007700">([</span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sorted</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Ds\Set Object
(
    [0] =&gt; 1
    [1] =&gt; 2
    [2] =&gt; 3
    [3] =&gt; 4
    [4] =&gt; 5
)</pre>
</div>
   </div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Beispiel #2 <span class="function"><strong>Ds\Set::sorted()</strong></span> example using a comparator</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$set </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Set</span><span style="color: #007700">([</span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">$sorted </span><span style="color: #007700">= </span><span style="color: #0000BB">$set</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sorted</span><span style="color: #007700">(function(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) {<br />    return </span><span style="color: #0000BB">$b </span><span style="color: #007700">&lt;=&gt; </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br />});<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$sorted</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Ds\Set Object
(
    [0] =&gt; 5
    [1] =&gt; 4
    [2] =&gt; 3
    [3] =&gt; 2
    [4] =&gt; 1
)</pre>
</div>
   </div>
  </div>

 </div>



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