note 70295 deleted from function.readdir by tularis

From: Date: Sun, 13 May 2007 18:59:22 +0000
Subject: note 70295 deleted from function.readdir by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126503@lists.php.net to get a copy of this message
Note Submitter: ---- Hi, i created a simple module to sort the contents of a dir using sort(). In the first part; it get the content of the directory (not sorted) and in the second part; it sort the contents and write line per line the result Sorry for my poor english;! <? $dir = getcwd(); // the best option is getcwd() $dh = opendir($dir); while (false !== ($file = readdir($dh))) { if (is_dir($file) && filesize($file)) {} else { echo "$file\n";} } sort($gi); // can be rsort($gi); while ($cn < $to){ echo ("$gi[$cn]\n"); $cn = $cn +1; } ?>

« previous php.notes (#126503) next »