note 57496 deleted from ref.dir by sniper

From: Date: Thu, 15 Dec 2005 23:59:14 +0000
Subject: note 57496 deleted from ref.dir by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100242@lists.php.net to get a copy of this message
Note Submitter: webcreator at centrum dot cz ---- I needed to make output of these Multi-Arrays using xhtml(valid)list. Here is the way how to get DirectoryTree. Recursively. # UL Tree----------------------------------------------------# function SetDirTree($MultiArray,$depth=-1,$stack=0) { foreach($MultiArray as $k=>$v) { if (is_array($v)) { $depth++; if ($olddepth!=$depth) { $stack++; echo "\n".'<ul>'; } if ($element>0) echo '</li>'; echo "\n".'<li>'.$k.''; $element++; $olddepth = $depth; SetDirTree($v,$depth,$stack); $depth--; } } if ($depth!=$stack) echo '</li></ul>'; } echo '<ul>'; SetDirTree($testlist);

« previous php.notes (#100242) next »