note 70295 added to function.readdir

From: Date: Tue, 10 Oct 2006 19:08:25 +0000
Subject: note 70295 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-118356@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 200.59.45.3 Probable Submitter: 201.252.213.96 ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- https://master.php.net/note/edit/70295 Del: integrated -- https://master.php.net/note/delete/70295/integrated Del: useless -- https://master.php.net/note/delete/70295/useless Del: bad code -- https://master.php.net/note/delete/70295/bad+code Del: spam -- https://master.php.net/note/delete/70295/spam Del: non-english -- https://master.php.net/note/delete/70295/non-english Del: in docs -- https://master.php.net/note/delete/70295/in+docs Del: other reasons-- https://master.php.net/note/delete/70295 Reject -- https://master.php.net/note/reject/70295 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#118356) next »