In-memory tree of objects class for PHP
Good day!
I'm Googling it second day already, but haven't found anything relevant, so that's my last chance before I'll start to reinvent the wheel :)
In ASP.NET I use generic tree classes, something like this: http://www.codeproject.com/KB/recipes/phSharpTree.aspx
Of course PHP lacks generics :), but I just want a class which give me ability to store my object in it and iterate through nodes using PHP5 iterators (from root to children, from selected node to root etc开发者_StackOverflow).
Thanks in advance!
PHP does support certain generics via the SPL (Standard PHP Library) that's been built in since PHP 5.0. There are also a wide variety of iterators available that might well be ideal. (Full list here.)
That said, the documentation is currently somewhat lacking in places, so you might have to do quite a bit of legwork yourself.
精彩评论