title: PHP Random Shuffle Array Maintaining Key => Value
body: <p>I've been looking on google for the answer but can't seem to find something fool-proof and cant really afford to mess this up (going live into a production site).</p>
  
  <p>What I have is an advanced search with 20+ filters, which returns an array including an ID and a Distance. What I need to do is shuffle these results to display in a random order every time. The array I have that comes out at the moment is:</p>
  
  <pre><code>Array (
      [0] =&gt; Array ( [id] =&gt; 1 [distance] =&gt; 1.95124994507577 )
      [1] =&gt; Array ( [id] =&gt; 13 [distance] =&gt; 4.75358968511882 )
      [2] =&gt; Array ( [id] =&gt; 7 [distance] =&gt; 33.2223233233323 )
      [3] =&gt; Array ( [id] =&gt; 21 [distance] =&gt; 18.2155453552336 )
      [4] =&gt; Array ( [id] =&gt; 102 [distance] = 221.2212587899658 )
  )
  </code></pre>
  
  <p>What I need to be able to do is randomise or order of these every time but maintain the id and distance pairs, i.e.:</p>
  
  <pre><code>Array (
      [4] =&gt; Array ( [id] =&gt; 102 [distance] = 221.2212587899658 )
      [1] =&gt; Array ( [id] =&gt; 13 [distance] =&gt; 4.75358968511882 )
      [3] =&gt; Array ( [id] =&gt; 21 [distance] =&gt; 18.2155453552336 )
      [2] =&gt; Array ( [id] =&gt; 7 [distance] =&gt; 33.2223233233323 )
      [0] =&gt; Array ( [id] =&gt; 1 [distance] =&gt; 1.95124994507577 )
  )
  </code></pre>
  
  <p>Thanks :)</p>