php - Remove parent level array from set of arrays and merge nodes -


i generating menu database, working problem is, parent node root have remove array.

array ( [0] => array ( [label] => root [url] => array ( [0] => category/view [id] => 1 )     [items] => array (           [0] => array ( [label] => designers [url] => array ( [0] => category/view [id] => 2 ) )           [1] => array ( [label] => women [url] => array ( [0] => category/view [id] => 3 ) [items] => array ( [0] => array ( [label] => current sales [url] => array ( [0] => category/view [id] => 8 ) [items] => array ( [0] => array ( [label] => suit selections [url] => array ( [0] => category/view [id] => 10 ) ) ) ) [1] => array ( [label] => ending [url] => array ( [0] => category/view [id] => 9 ) ) ) )           [2] => array ( [label] => men [url] => array ( [0] => category/view [id] => 4 ) )           [3] => array ( [label] => make own [url] => array ( [0] => category/view [id] => 5 ) )           [4] => array ( [label] => clearance [url] => array ( [0] => category/view [id] => 6 ) )           [5] => array ( [label] => out of box [url] => array ( [0] => category/view [id] => 7 ) ) ) ) ) 

i want array start [items] => array(), how remove parent node.

the desired solution must be:

array (           [0] => array ( [label] => designers [url] => array ( [0] => category/view [id] => 2 ) )           [1] => array ( [label] => women [url] => array ( [0] => category/view [id] => 3 ) [items] => array ( [0] => array ( [label] => current sales [url] => array ( [0] => category/view [id] => 8 ) [items] => array ( [0] => array ( [label] => suit selections [url] => array ( [0] => category/view [id] => 10 ) ) ) ) [1] => array ( [label] => ending [url] => array ( [0] => category/view [id] => 9 ) ) ) )           [2] => array ( [label] => men [url] => array ( [0] => category/view [id] => 4 ) )           [3] => array ( [label] => make own [url] => array ( [0] => category/view [id] => 5 ) )           [4] => array ( [label] => clearance [url] => array ( [0] => category/view [id] => 6 ) )           [5] => array ( [label] => out of box [url] => array ( [0] => category/view [id] => 7 ) ) ) ) ) 

i not sure understood well, want?

$desired_array=$old_array[0]['items'] 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -