Skip to content

Instantly share code, notes, and snippets.

@rileypaulsen
Created August 12, 2013 04:42
Show Gist options
  • Save rileypaulsen/6208288 to your computer and use it in GitHub Desktop.
Save rileypaulsen/6208288 to your computer and use it in GitHub Desktop.
list the files in a directory
<?php
echo '<ul>';
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ( !empty($entry) && $entry != "." && $entry != ".." && $entry != "" && $entry != 'index.php') {
echo '<li><a href="'.$entry.'">'.$entry.'</a></li>'.PHP_EOL;
}
}
closedir($handle);
}
echo '</ul>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment