title: I want to sort an array in reverse order of values in php
body: <p>I want to sort an array in reverse order of values. I used arsort php function but the result is not good for me.</p>
  
  <p>Example:</p>
  
  <p>I want to sort next array:</p>
  
  <pre><code>myArray = array("d" =&gt; 1, "f" =&gt; 2, "b" =&gt; 3, "c" =&gt; 4,  "e" =&gt; 2); 
  </code></pre>
  
  <p>after using arsort php function the result is:</p>
  
  <pre><code>myArray =array ( "c" =&gt; 4, "b" =&gt; 3, "e" =&gt; 2, "f" =&gt; 2, "d" =&gt; 1 );
  </code></pre>
  
  <p>which it is not good because the arsort function doesn't keep initial order of elements in array.</p>
  
  <p>I want the result like:</p>
  
  <pre><code>myArray =array ( "c" =&gt; 4, "b" =&gt; 3, "f" =&gt; 2, "e" =&gt; 2, "d" =&gt; 1 );
  </code></pre>
  
  <p>f before e order, like from original array. keys with same value to not reverse.
  Thanks.</p>