title: PHP re-order array by selecting an item to be the first
body: <p>I have a rather complicated issue that's probably related to <code>array_splice</code> but I can't figure it out. Here's an example of the array I have:</p>
  
  <pre><code>array(
   'a' =&gt; 'Element A',
   'b' =&gt; 'Element B',
   'c' =&gt; 'Element C',
   'd' =&gt; 'Element D',
   'e' =&gt; 'Element E'
  );
  </code></pre>
  
  <p>What I want to do is reorder the array based on the key I select, say "c", such that the end result is:</p>
  
  <pre><code>array(
   'c' =&gt; 'Element C',
   'd' =&gt; 'Element D',
   'e' =&gt; 'Element E',
   'a' =&gt; 'Element A',
   'b' =&gt; 'Element B'
  );
  </code></pre>
  
  <p>It basically moves the selected key to the front, while keeping the ordering intact. Any help is greatly appreciated!</p>