title: How to add a new [key] => [value] pair after a specific Associative Key in an Assoc Array in PHP?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1783089/array-splice-for-associative-arrays">array_splice() for associative arrays</a><br>
    <a href="https://stackoverflow.com/questions/2149437/how-to-add-an-array-value-to-the-middle-of-an-associative-array">How to add an array value to the middle of an associative array?</a>  </p>
  </blockquote>
  
  
  
  <p>How can I add a new <code>[key] =&gt; [value]</code> pair after a specific Associative Key in an Assoc Array in PHP ?</p>
  
  <p>For example, let's say we have an array called <code>$fruits</code>:</p>
  
  <pre><code>array {
     [apple] =&gt; 1
     [banana] =&gt; 3
     [orange] =&gt; 4
  }
  </code></pre>
  
  <p>How can I add <code>[plum] =&gt; 2</code> to <code>$fruits</code> so that it appears after the <code>[apple]</code> key but before <code>[banana]</code> key ?</p>
  
  <p>Thanks.</p>