title: Add elements to array which has gapped numeric keys to form an indexed array / list
body: <p>I have an array like this:</p>
  <pre><code>$array = [
      0 =&gt; 'Apple',
      2 =&gt; 'Orange',
      5 =&gt; 'Pear',
      8 =&gt; 'Pear'
  ]
  </code></pre>
  <p>Is there a way to fill in the missing indexes with a default value (for example, an empty string or <code>null</code>)?</p>
  <p>I'd like to insert new elements into the array at the following keys: <code>1</code>, <code>3</code>, <code>4</code>, <code>6</code>, <code>7</code></p>
  <p>My result should be:</p>
  <pre><code>[
      0 =&gt; 'Apple',
      1 =&gt; '',
      2 =&gt; 'Orange',
      3 =&gt; '',
      4 =&gt; '',
      5 =&gt; 'Pear',
      6 =&gt; '',
      7 =&gt; '',
      8 =&gt; 'Pear'
  ]
  </code></pre>