note 77466 deleted from function.scandir by cece

From: Date: Fri, 31 Aug 2007 11:55:29 +0000
Subject: note 77466 deleted from function.scandir by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129931@lists.php.net to get a copy of this message
Note Submitter: george at REMOVE-THIScommentsville dot com ---- Much simpler script to list all directories within a given directory, while removing the . and .. <?php $mydir = dir('/path/to/directory/'); //include the trailing slash here while(($file = $mydir->read()) !== false) { $upper = ucwords($file); if(is_dir($mydir->path.$file) == true && $file != '.' && $file != '..') { echo "<li><strong><a href='$file'>$upper</a></strong></li>"; } } $mydir->close(); ?>

« previous php.notes (#129931) next »