I found a snippet of code that took an array and organized it in parent child multi level organization. like the following
$phases = array(
array('id'=>1,'name'=>'First Step','parent_id'=>0,'percentage'=>.50,'order'=>1),
array('id'=>2,'name'=>'Second Step','parent_id'=>0, 'percentage'=>.50,'order'=>2),
array('id'=>3,'name'=>'Third Step','parent_id'=>2, 'percentage'=>.25,'order'=>3),
array('id'=>4,'name'=>'Fourth Step','parent_id'=>2, 'percentage'=>.25,'order'=>1),
array('id'=>5,'name'=>'Fifth Step','parent_id'=>2, 'percentage'=>.25,'order'=>1),
array('id'=>6,'name'=>'Sixth Step','parent_id'=>2, 'percentage'=>.25,'order'=>1),
);
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
1 Answer