Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created June 20, 2013 11:41
Show Gist options
  • Save mageekguy/5822078 to your computer and use it in GitHub Desktop.
Save mageekguy/5822078 to your computer and use it in GitHub Desktop.
<?php
class dotFilter extends \recursiveFilterIterator
{
public function accept()
{
return (substr($this->getInnerIterator()->current(), 0, 1) != '.');
}
}
$i = new recursiveIteratorIterator(new dotFilter(new recursiveDirectoryIterator('/path/to/an/empty/directory')));
var_dump($i->key()); // null with PHP 5.5, 0 with PHP < 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment