Skip to content

Instantly share code, notes, and snippets.

@isevcik
Created December 25, 2016 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isevcik/32cd3a8b671e1383920812493bdc8443 to your computer and use it in GitHub Desktop.
Save isevcik/32cd3a8b671e1383920812493bdc8443 to your computer and use it in GitHub Desktop.
List directories in parent directory of current PHP file
<?php
if ($handle = opendir('..')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "<a href='http://$entry." . basename(dirname(dirname(__FILE__))) . "'>$entry</a><br>";
}
}
closedir($handle);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment