Пример #1
0
<?php

$a = new FileSystemIterator(__DIR__);
$b = clone $a;
var_dump((string) $b == (string) $a);
var_dump($a->key() == $b->key());
$a->next();
$a->next();
$a->next();
$c = clone $a;
var_dump((string) $c == (string) $a);
var_dump($a->key() == $c->key());
?>
===DONE===
<?php

$files = new FileSystemIterator(__DIR__, FilesystemIterator::CURRENT_AS_SELF);
foreach ($files as $key => $file) {
    if ($files->isDir()) {
        continue;
    }
    echo $key, ' => ', $files->isExecutable() ? 'sim' : 'não', "\n";
}
Пример #3
0
 /**
  * Generates a weak fingerprint based on some attributes of the file (does not require to read the whole file)
  * 
  * @param FileSystemIterator $file File object
  * 
  * @return string Weak fingerprint
  */
 protected function generateWeakFingerprint($file)
 {
     $parts = array($file->getSize(), $file->getCTime(), $file->getOwner(), $file->getMTime());
     return implode('_', $parts);
 }