public static function getDirContents($dir, &$results = array()) { $files = scandir($dir); foreach ($files as $key => $value) { $path = realpath($dir . DIRECTORY_SEPARATOR . $value); if (!is_dir($path)) { $results[] = $path; } else { if (is_dir($path) && $value != "." && $value != "..") { Annotations::getDirContents($path, $results); $results[] = $path; } } } return $results; }