-
-
Save Majkl578/895ea775ab425288aab1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
clearstatcache(); | |
$s = microtime(TRUE); | |
$iterator = new RegexIterator(new DirectoryIterator('/tmp/test'), '~^\d+x$~'); // filtrování ve složce /foo/bar na základě PCRE regulárního výrazu pro název souboru/složky | |
if (iterator_count($iterator)) { // pokud existuje alespoň 1 záznam | |
foreach ($iterator as $item) { //procházení | |
if ($item->isDot() || $item->getFilename() === '.htaccess' || $item->getFilename() === '.ftpaccess') continue; //přeskočit ., .. a ty 2 soubory | |
echo $item->getFilename(), "\n"; | |
} | |
} else { // pokud neexistuje nic | |
echo 'Nenalezeny žádné položky'; | |
} | |
var_dump(microtime(TRUE) - $s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment