RecursiveIteratorIterator and RecursiveDirectoryIterator to nested html lists
Here is one using DomDocument The basic idea is the contents of each directory is represented by a <ul> and each element in the directory by a <li> If element is a non-empty directory it will contain a <ul> to represent its contens and so on. $path = $_SERVER[‘DOCUMENT_ROOT’].’/test’; $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); … Read more