Showing posts with label spl. Show all posts
Showing posts with label spl. Show all posts

May 11, 2013

Custom RecursiveIterator

PHP RecursiveIterator and its relatives are quite handy in any tree-related situation. Probably the most used is RecursiveDirectoryIterator for getting all files recursively in a directory. But this family of iterators has some issues to be addressed so that developers do not end up fleeing. First, you must not fear SPL. But there's more. Let's see…

September 21, 2010

Safe RecursiveDirectoryIterator

I love SPL... so simple, so powerful, so flexible.

RecursiveDirectoryIterator was having problems while scanning a directory and threw me some nice errors on permissions, so I coded the snippet below...