title: PHP: Filling in the 'gaps' in an array
body: <p>I've got a php array (obtained through checkbox values in a form - as you know checkboxes only show up in the _POST variable when they are not set).</p>
  
  <pre><code>Array
  (
      [2] =&gt; 0,2
      [3] =&gt; 0,3
  )
  </code></pre>
  
  <p>I need a way to 'fill in' the gaps between the range 0-5. So above would look like (filling the empty spaces with '-1'. I tried <code>array_merge()</code> with an array filled with '-1' but that didn't work.</p>
  
  <pre><code>Array
  (
      [0] =&gt; -1
      [1] =&gt; -1
      [2] =&gt; 0,2
      [3] =&gt; 0,3
      [4] =&gt; -1
      [5] =&gt; -1
  )
  </code></pre>
  
  <p>I think I may have gone down the wrong road with the problem I am trying to solve, but I have put too much time into this solution to back out - a feeling I am sure most of you are familiar with(!)</p>
  
  <p>Cheers!</p>