<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.arrayiterator.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'arrayiterator.ksort.php',
    1 => 'ArrayIterator::ksort',
    2 => 'Sort entries by keys',
  ),
  'up' => 
  array (
    0 => 'class.arrayiterator.php',
    1 => 'ArrayIterator',
  ),
  'prev' => 
  array (
    0 => 'arrayiterator.key.php',
    1 => 'ArrayIterator::key',
  ),
  'next' => 
  array (
    0 => 'arrayiterator.natcasesort.php',
    1 => 'ArrayIterator::natcasesort',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/arrayiterator/ksort.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="arrayiterator.ksort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ArrayIterator::ksort</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ArrayIterator::ksort</span> &mdash; <span class="dc-title">Sort entries by keys</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-arrayiterator.ksort-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ArrayIterator::ksort</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code><a href="array.constants.php#constant.sort-regular">SORT_REGULAR</a></code></strong></span></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Sorts entries by their keys.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
 <p class="para">
  If two members compare as equal, they retain their original order.
  Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
 </p>
</p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-arrayiterator.ksort-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <dl>
   
  <dt><code class="parameter">flags</code></dt>
  <dd>
   <p class="para">
    The optional second parameter <code class="parameter">flags</code>
    may be used to modify the sorting behavior using these values:
   </p>
   <p class="para">
    Sorting type flags:
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-regular">SORT_REGULAR</a></code></strong> - compare items normally;
      the details are described in the <a href="language.operators.comparison.php" class="link">comparison operators</a> section</span>
     </li>
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-numeric">SORT_NUMERIC</a></code></strong> - compare items numerically</span>
     </li>
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong> - compare items as strings</span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="array.constants.php#constant.sort-locale-string">SORT_LOCALE_STRING</a></code></strong> - compare items as
       strings, based on the current locale. It uses the locale,
       which can be changed using <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="array.constants.php#constant.sort-natural">SORT_NATURAL</a></code></strong> - compare items as strings
       using &quot;natural ordering&quot; like <span class="function"><a href="function.natsort.php" class="function">natsort()</a></span>
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="array.constants.php#constant.sort-flag-case">SORT_FLAG_CASE</a></code></strong> - can be combined
       (bitwise OR) with
       <strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong> or
       <strong><code><a href="array.constants.php#constant.sort-natural">SORT_NATURAL</a></code></strong> to sort strings case-insensitively
      </span>
     </li>
    </ul>
   </p>
  </dd>
 

  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-arrayiterator.ksort-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Always returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-arrayiterator.ksort-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versione</th>
       <th>Descrizione</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
 <td>8.2.0</td>
 <td>
  The return type is <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> now; previously, it was <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>.
 </td>
</tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-arrayiterator.ksort-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="arrayiterator.asort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::asort()</a> - Sort entries by values</span></li>
    <li><span class="methodname"><a href="arrayiterator.natcasesort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::natcasesort()</a> - Sort entries naturally, case insensitive</span></li>
    <li><span class="methodname"><a href="arrayiterator.natsort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::natsort()</a> - Sort entries naturally</span></li>
    <li><span class="methodname"><a href="arrayiterator.uasort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::uasort()</a> - Sort with a user-defined comparison function and maintain index association</span></li>
    <li><span class="methodname"><a href="arrayiterator.uksort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::uksort()</a> - Sort by keys using a user-defined comparison function</span></li>
    <li><span class="function"><a href="function.ksort.php" class="function" rel="rdfs-seeAlso">ksort()</a> - Ordina rispetto alle chiavi di un array</span></li>
   </ul>
  </p>
 </div>


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