Re: create tree from arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks to all, it works now:

    function mktree_array(&$arr, $id = 0)
    {
       $result = array();
       foreach ($arr as $a) {
           if ($id == $a['parentID']) {
               $a['children']  = $this->mktree_array($arr, $a['nid']);
               $result[] = $a;
           }
       }
       return $result;
    }


merci

Shahrzad ;)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux