Re: Directory & Array

From: Date: Thu, 06 Jul 2000 01:09:37 +0000
Subject: Re: Directory & Array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5131@lists.php.net to get a copy of this message
In article <20000705130504.87530.qmail@hotmail.com>, npurciful@hotmail.com ("Nathan Purciful") wrote: > Could someone please show me how to load a directory into array and print it > in alphabetic order? Untested: <?php $dir = opendir('/path/to/your/dir') or die('Could not open dir.'); while ($file = readdir($dir)){ $files[] = $file; } closedir($dir); sort($files); reset($files); while (list($k, $v) = each($files)){ echo $v, "<BR>\n"; } ?> -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#5131) next »