title: Insert "between" numeric keys in array php
body: <p>I am currently writing a class which is going to handle output from other objects. The class constructs a numeric array at the first dimension with HTML <em>"fields"</em>, containing tag, attributes and content. Content will be then a numeric array again for HTML tags nesting. If <code>'Tag'</code> is NULL, it is considered direct text.</p>
  
  <pre><code>$output = array( //Numeric array
      array( //Associative array 
          'Tag' =&gt; 'h3',
          'Attributes' =&gt; 'id=SomeTitle',
          'Contents' =&gt; array (), //Numeric array again, same as first dimension,
      ),
      array( //Associative array 
          'Tag' =&gt; 'p',
          'Attributes' =&gt; 'id=someID',
          'Contents' =&gt; array (), //Numeric array again, same as first dimension
      ),
  );
  </code></pre>
  
  <p>The question now is: is there an <strong>easy way</strong> to insert data on an already defined position? Let's say I want a new associative array to be placed in <code>$output[1]</code> and all other indexes equal and higher then to be incremented by one.</p>
  
  <p>I know that I could write a method that iterate over the array in reverse and increase all those indexes. It's just that I'm wondering if I overlooked anything in the PHP handbook, that handles the same thing.</p>