PHP - "tabulate" array - make levels from elements

Posted by Moha on Programmers See other posts from Programmers or by Moha
Published on 2012-10-14T21:22:22Z Indexed on 2012/10/14 21:50 UTC
Read the original article Hit count: 263

Filed under:
|
|

If I have an array like this:

Array
 (
   [0] => field_schools
   [1] => und
   [2] => 0
   [3] => field_school
   [4] => und
   [5] => 0
   [6] => value
 )

How can I make an array like this from it?

array
 (
   [field_schools] => array 
   (
     [und] => array 
     (
       [0] => array
       (
         [field_school] => array
         (
           [und] => array
           (
             [0] => array
             (
               [value] => something
             )
           )
         )
       )
     )
   )
 )

I want to specify the 'value' myself.

© Programmers or respective owner

Related posts about php

Related posts about recursion