Good day to all
When displaying the hierarchy of files in a directory, it incorrectly determines the type of file, what can it be connected with?
<?php function reader_directory($path, $level = 0) { $space = ""; for ($i = 0; $i < $level; $i++) { $space .= "-"; } if (file_exists($path)) { $d = opendir($path); $mass = " "; do { if ($mass != "." && $mass != ".." && $mass != " ") { if (is_dir($mass)) { echo $space . "[DIR]" . $mass . "<br>"; reader_directory($path . "/" . $mass, $level + 5); } elseif (is_file($mass)) { echo $space . "[FILE]" . $mass . "<br>"; } else { echo $space . "[OTHER]" . $mass . "<br>"; } } } while ($mass = readdir($d)); closedir($d); } } reader_directory(".", 1); ?> 