Skip to content

Instantly share code, notes, and snippets.

@mikestreety
Created December 18, 2013 16:20
Show Gist options
  • Save mikestreety/8025134 to your computer and use it in GitHub Desktop.
Save mikestreety/8025134 to your computer and use it in GitHub Desktop.
List all the items in a dir
<?php
$dir = dirname(__FILE__); // Sets the dir you want to show images for
foreach(scandir($dir) as $item) : // for every item in the folder
if($item == '.') continue; // If it equals to any of these, don't show them
if($item == '..') continue;
if($item == 'index.php') continue; ?>
<?=$item?> <!-- echo the path -->
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment