Re: create tree from arrays

From: Date: Sat, 15 May 2010 07:58:51 +0000
Subject: Re: create tree from arrays
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-305246@lists.php.net to get a copy of this message
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 ;)

« previous php.general (#305246) next »