List Info

Thread: note 77466 added to function.scandir




note 77466 added to function.scandir
user name
2007-08-30 13:27:18
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/77466
Del: integrated  -- h
ttps://master.php.net/note/delete/77466/integrated
Del: useless     -- http
s://master.php.net/note/delete/77466/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/77466/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/77466/spam
Del: non-english -- 
https://master.php.net/note/delete/77466/non-english
Del: in docs     -- http
s://master.php.net/note/delete/77466/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77466
Reject      -- https://mast
er.php.net/note/reject/77466
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


note 77466 deleted from function.scandir by cece
user name
2007-08-31 06:55:29
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>&q
uot;;

      } 

   }
   $mydir->close();
?>

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


[1-2]

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