Tree classA class for handling tree strutures. Documentation available via inline docs and also in standalone Word and PDF formats. This is bundled using the PEAR installer, so you can download and install manually, or with the installer. It WILL conflict with the Tree class available via the PEAR website if you have it installed, so don't install both at once. Trust me, this is better. ;-) Latest versionLatest version (2.0.0) is PHP5 only. Prior version is still available in the download area (1.0.3) for PHP4. Now totally takes advantage of PHP5s OO model and references. Also, creating a Tree structure is now facilitated by the Tree::factory() method, which takes a Tree_Factory_Iterator interface as an argument. Pass it an object and as long as it implements this interface (which incidentally inherits from RecursiveIterator) properly, then the factory method will return you a nice shiny new Tree object. Two examples are included which create Tree objects from an array (ala previous versions) and from the filesystem. Some sample code:
<?php
And this is the documentation from the head of Tree.php (which I couldn't be arsed to rewrite:
<?php
Download now Link to meIf you use any of the code on this site (and if you don't I guess) or it makes your life easier, I'd appreciate a link - http://www.phpguru.org. Thanks. |
