title: organize php array into multi level child parent organization
body: <p>I found a snippet of code that took an array and organized it in parent child multi level organization. like the following</p>
  
  <pre><code>$phases = array(
      array('id'=&gt;1,'name'=&gt;'First Step','parent_id'=&gt;0,'percentage'=&gt;.50,'order'=&gt;1),
      array('id'=&gt;2,'name'=&gt;'Second Step','parent_id'=&gt;0, 'percentage'=&gt;.50,'order'=&gt;2),
      array('id'=&gt;3,'name'=&gt;'Third Step','parent_id'=&gt;2, 'percentage'=&gt;.25,'order'=&gt;3),
      array('id'=&gt;4,'name'=&gt;'Fourth Step','parent_id'=&gt;2, 'percentage'=&gt;.25,'order'=&gt;1),
      array('id'=&gt;5,'name'=&gt;'Fifth Step','parent_id'=&gt;2, 'percentage'=&gt;.25,'order'=&gt;1),
      array('id'=&gt;6,'name'=&gt;'Sixth Step','parent_id'=&gt;2, 'percentage'=&gt;.25,'order'=&gt;1),
      );
  </code></pre>
  
  <p>it was able to add all the child arrays under their respectful  parent. I can not find the code for that. anyone have an idea</p>