Hierarchical data into array
<p>I need some logic for the following problem, but can't get my head around it. Basically I have some data like the following array</p>

<pre><code>array(
    array('name' =&gt; 'Test1',
          'hierarchy'=&gt; '1'),
    array('name' =&gt; 'Test2',
          'hierarchy'=&gt; '1.1'),
    array('name' =&gt; 'Test3',
          'hierarchy'=&gt; '1.2'),
    array('name' =&gt; 'Test4',
          'hierarchy'=&gt; '1.2.1')
)
</code></pre>

<p>Now I would like to output an array in such a way that</p>

<pre><code>$array[1] = 'Test1';
$array[1][2][1] = 'Test4';
</code></pre>

<p>Tried dynamic variable naming and dynamically creating multidimensional arrays, but both dont seem to work.</p>
