I was about to write code to recursively list the contents of a directory when I remembered seeing an object in SPL that would do it for me:

http://us3.php.net/manual/en/function.recursivedirectoryiterator-next.php

But there is no documentation on this object, and although I have it in PHP 5.1.4, docs say it's might be only in CVS. So, I try using it and get this:

<?php
$dir = new RecursiveDirectoryIterator("/some/dir/path");
while($dir->valid()) {
   print $dir->current()."\n";
  $dir->next();
}
?>

But it doesn't seem to recurse through the directories. In fact, this acts just like DirectoryIterator. So, there must be a flag to make it recurse, but documentation is not there. I see this documentation here:

   http://www.php.net/~helly/php/ext/spl/

But that just looks like the source code was parsed to generate it, nothing much help in seeing an example of the usage.

Is SPL meant to be used? If so, is it experimental? Is it documented? Should I stay away from SPL for production code? What's the official word?

Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to