Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 102

php-manual-en-7.2.11-1.mga7.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>Sort with a user-defined comparison function and maintain index association</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="arrayiterator.setflags.html">ArrayIterator::setFlags</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="arrayiterator.uksort.html">ArrayIterator::uksort</a></div>
 <div class="up"><a href="class.arrayiterator.html">ArrayIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="arrayiterator.uasort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ArrayIterator::uasort</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">ArrayIterator::uasort</span> &mdash; <span class="dc-title">Sort with a user-defined comparison function and maintain index association</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-arrayiterator.uasort-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>ArrayIterator::uasort</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$cmp_function</code></span>
   )</div>

  <p class="para rdfs-comment">
   This method sorts the elements such that indices maintain their correlation
   with the values they are associated with, using a user-defined comparison
   function.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
 <p class="para">
  If two members compare as equal, their relative order in the sorted array is undefined.
 </p>
</p></blockquote>

 </div>


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

    
     <dt>
<code class="parameter">cmp_function</code></dt>

     <dd>

      <p class="para">
       The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to 2147483647.
      </p>
      <div class="methodsynopsis dc-description"><span class="type">int</span> <span class="methodname"><span class="replaceable">callback</span></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">$a</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">$b</code></span> )</div>

     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-arrayiterator.uasort-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   No value is returned.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-arrayiterator.uasort-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="arrayiterator.asort.html" class="methodname" rel="rdfs-seeAlso">ArrayIterator::asort()</a> - Sort array by values</span></li>
    <li class="member"><span class="methodname"><a href="arrayiterator.uksort.html" class="methodname" rel="rdfs-seeAlso">ArrayIterator::uksort()</a> - Sort by keys using a user-defined comparison function</span></li>
    <li class="member"><span class="function"><a href="function.usort.html" class="function" rel="rdfs-seeAlso">usort()</a> - Sort an array by values using a user-defined comparison function</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="arrayiterator.setflags.html">ArrayIterator::setFlags</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="arrayiterator.uksort.html">ArrayIterator::uksort</a></div>
 <div class="up"><a href="class.arrayiterator.html">ArrayIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>