php transform array into multidim array

Posted by fverswijver on Stack Overflow See other posts from Stack Overflow or by fverswijver
Published on 2010-04-20T19:59:18Z Indexed on 2010/04/20 20:03 UTC
Read the original article Hit count: 174

So I'm working on a website with Doctrine as ORM and I get the following array back as a result:

Array ( [0] => Array ( [c_cat_id] => 1 [c_title] => Programas e projetos [p_menu] => PBA BR 163 [p_page_id] => 1 ) [1] => Array ( [c_cat_id] => 1 [c_title] => Programas e projetos [p_menu] => Outros projetos [p_page_id] => 3 ) ) 

Is it possible to transform this array (in PHP) to something like this:

Array ( [0] => Array ( [c_cat_id] => 1 [c_title] => Programas e projetos [pages] => Array ([p_page_id] => 1 [p_menu] => PBA BR 163, [p_page_id] => 3 [p_menu] => Outros projetos))

Thanks for your help, always eager to learn new ways of doing things and that's why I love StackOverflow ;)

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays