List directory contents

function getDirectoryList($directory){
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
// if file isn't this directory or its parent, add it to the results
if ($file != "." && $file != "..") $results[] = $file;
}
closedir($handler);
return $results;
}

0 Comments

You must be logged in to post a comment.