List Info

Thread: note 77467 added to function.scandir




note 77467 added to function.scandir
user name
2007-08-30 13:27:49
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>&q
uot;;

      } 

   }
   $mydir->close();
?>
----
Server IP: 64.71.164.2
Probable Submitter: 214.3.17.38
----
Manual Page -- htt
p://www.php.net/manual/en/function.scandir.php
Edit        -- https://master
.php.net/note/edit/77467
Del: integrated  -- h
ttps://master.php.net/note/delete/77467/integrated
Del: useless     -- http
s://master.php.net/note/delete/77467/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/77467/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/77467/spam
Del: non-english -- 
https://master.php.net/note/delete/77467/non-english
Del: in docs     -- http
s://master.php.net/note/delete/77467/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77467
Reject      -- https://mast
er.php.net/note/reject/77467
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )