title: array_merge not working as expected
body: <p>I have an double level array.
  On the first level there are about 10 indexes.
  These contain each to a 275 element array which each contains a word.</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
      [0] =&gt; Suspendisse
      [1] =&gt; Nam.
      [2] =&gt; Amet
      [3] =&gt; amet
      [4] =&gt; urna
      [5] =&gt; condimentum
      [6] =&gt; Vestibulum
      [7] =&gt; sem
      [8] =&gt; at
      [9] =&gt; Curabitur
      [10] =&gt; lorem
      .... to [275]
      )
  [1] =&gt; Array
      (
      ... you get the idea
      )
  ... 10 elements total
  )
  </code></pre>
  
  <p>Now, through circumstances, like an added image that takes up space, I sometimes need to recalculate the number of words that are remaining and redistribute the array that still remains.</p>
  
  <p>For that I have written the below function to make the remaining array one big long array of words, that I can array_chunk then to the right proportions.
  &amp;$array is the reference to the "mother array", $memory is an array of words that are surplus, $index is where we are iterating through a for loop, $limit is "array" length for the 2nd level, in this case 275</p>
  
  <pre><code>function redistribute(&amp;$array,$memory,$index,$limit)
  {
  $ret[] = $array[0];
  // skip past the current processed items
  for($c=1;$c&lt;$index;$c++)
      {
      $ret[] = $array[$c];
      }
  // apply current item
  $ret[] = $array[$index];
  
  //join the rest into one big array off words;
  $r2=$memory;
  $length = count($array);
  for($c=$index+1;$c&lt;$length;++$c)
      {
      array_merge($r2,$array[$c]);
      print_r($r2);
      }
  }
  </code></pre>
  
  <p><strong>The question</strong></p>
  
  <p>array_merge(arr1,arr2) doesn't seem to work.</p>
  
  <p>when executing</p>
  
  <pre><code>redistribute($splitupchunk,array('test','test2','test3','test4'),$i,275);
  </code></pre>
  
  <p>print_r($r2) just prints test numbers without the extra variables from $array[$c].
  How do I fix this?</p>