note 39148 deleted from ref.dir by sniper
| From: | sniper@php.net | Date: | Fri, 16 Dec 2005 00:00:30 +0000 |
| Subject: | note 39148 deleted from ref.dir by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100258@lists.php.net to get a copy of this message | ||
Note Submitter: sc1n at yahoo dot com
----
The following function returns a tree of the directory structure from the given start point.
<?php
function Fetch_File_Tree($start_directory)
{
if( $dir = opendir($start_directory) )
{
$tree = array();
while( FALSE !== ($file = readdir($dir)) )
{
if($file != "." && $file != "..")
{
$absolute_file = $start_directory . $file;
is_file($absolute_file) ? $tree[] = $file : $tree[$file] = Fetch_File_Tree($absolute_file .
"/");
}
}
}
else
{
return FALSE;
}
return $tree;
}
?>