title: php put arrays in arrays
body: <p>I want to push some items in one array, here is the structure:</p>
  
  <pre><code>$str = 'String';
  $a = array('some', 'sub', 'page');
  </code></pre>
  
  <p>and I want to push the items to some other array that should become:</p>
  
  <pre><code>Array (
     [some] =&gt; Array (
        [sub] =&gt; Array (
           [page] =&gt; String
        )
     )
  )
  </code></pre>
  
  <p>I don't know how exactly to explain it, so hope the example shows you something.
  I want any new element in the first array (a) to be pushed as sub-array of the prevous one and the last to have the value from $str;</p>
  
  <pre><code>$string = 'My Value';
  $my_first_array = array('my', 'sub', 'arrays');
  </code></pre>
  
  <p>Then some function to parse $my_first_array and transfer it as:</p>
  
  <p>Example:</p>
  
  <pre><code>ob_start('nl2br');
  $my_parsed_sub_array = parse_sub_arrays($my_first_array, $string);
  print_r($my_parsed_sub_array);
  </code></pre>
  
  <p>===>>></p>
  
  <pre><code>Array (
     [my] =&gt; Array (
        [sub] =&gt; Array (
           [arrays] =&gt; String
        )
     )
  )
  </code></pre>