<?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 => 'ru',
  ),
  'this' => 
  array (
    0 => 'arrayiterator.asort.php',
    1 => 'ArrayIterator::asort',
    2 => 'Сортирует элементы по значениям',
  ),
  'up' => 
  array (
    0 => 'class.arrayiterator.php',
    1 => 'ArrayIterator',
  ),
  'prev' => 
  array (
    0 => 'arrayiterator.append.php',
    1 => 'ArrayIterator::append',
  ),
  'next' => 
  array (
    0 => 'arrayiterator.construct.php',
    1 => 'ArrayIterator::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/spl/arrayiterator/asort.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="arrayiterator.asort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ArrayIterator::asort</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ArrayIterator::asort</span> &mdash; <span class="dc-title">Сортирует элементы по значениям</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-arrayiterator.asort-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ArrayIterator::asort</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">
   Сортирует элементы по значениям.
  </p>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
<p class="para">Функция сохраняет первоначальный порядок элементов, если
при сравнении значения двух элементов равны. До PHP 8.0.0 взаимный порядок одинаковых по значению элементов
в отсортированном массиве оставался неопределённым.</p></p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-arrayiterator.asort-parameters">
  <h3 class="title">Список параметров</h3>
  <dl>
   
  <dt><code class="parameter">flags</code></dt>
  <dd>
   <p class="para">
    Необязательный второй параметр <code class="parameter">flags</code> изменяет поведение сортировки и принимает следующие значения:
   </p>
   <p class="para">
    Флаги типов сортировки:
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-regular">SORT_REGULAR</a></code></strong> — обычное сравнение элементов;
      подробности описаны в разделе <a href="language.operators.comparison.php" class="link">операторы сравнения</a></span>
     </li>
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-numeric">SORT_NUMERIC</a></code></strong> — числовое сравнение элементов</span>
     </li>
     <li class="listitem">
      <span class="simpara"><strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong> — строковое сравнение элементов</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> — сравнение элементов
       как строк на основе текущего языкового стандарта. Флаг использует языковой стандарт,
       который доступен для изменения4 функцией <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> — сравнение элементов как строк
       на основе «естественного порядка» наподобие <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> — флаг объединяют
       через побитовое ИЛИ
       с флагом <strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong>
       или <strong><code><a href="array.constants.php#constant.sort-natural">SORT_NATURAL</a></code></strong> для сортировки строк без учёта регистра
      </span>
     </li>
    </ul>
   </p>
  </dd>
 

  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-arrayiterator.asort-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Функция возвращает логическое значение <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-arrayiterator.asort-changelog">
  <h3 class="title">Список изменений</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Версия</th>
       <th>Описание</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
 <td>8.2.0</td>
 <td>
  Значение возврата теперь принадлежит типу <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>; раньше значение принадлежало типу <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.asort-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="arrayiterator.ksort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::ksort()</a> - Сортирует элементы по ключам</span></li>
    <li><span class="methodname"><a href="arrayiterator.natcasesort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::natcasesort()</a> - Сортирует элементы &quot;натурально&quot;, с учётом регистра</span></li>
    <li><span class="methodname"><a href="arrayiterator.natsort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::natsort()</a> - Сортирует записи естественным образом</span></li>
    <li><span class="methodname"><a href="arrayiterator.uasort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::uasort()</a> - Сортировка с помощью заданной пользователем функции и сохранением ключей</span></li>
    <li><span class="methodname"><a href="arrayiterator.uksort.php" class="methodname" rel="rdfs-seeAlso">ArrayIterator::uksort()</a> - Сортирует по ключам пользовательской функцией сравнения</span></li>
    <li><span class="function"><a href="function.asort.php" class="function" rel="rdfs-seeAlso">asort()</a> - Сортирует массив в порядке возрастания, сохраняя ассоциацию индексов</span></li>
   </ul>
  </p>
 </div>


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