I work with my code that displays all folders and subfolders in my directory.
I have a simple problem. Some results are repeated or repeated, and I do not want to display them.
How can i do this?
<?php
$dir = 'apps/';
$result = array();
if (is_dir($dir)) {
$iterator = new RecursiveDirectoryIterator($dir);
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {
if (!$file->isFile()) {
$result = $file->getPath()."<br>";
echo $result;
}
}
}
?>
source
share