|
Posted by tim on 11/02/62 11:48
Chris wrote:
Hi
>
> I have a function (fileTree) that recursively reads all the files in a
> directory passed to it, and returns an array of the files, I have included
> the code for this function below.
> if (is_dir($directory. "/" . $file))
> {
> $dir_array = array_merge($dir_array, $this->fileTree($directory.
> "/" . $file,$ext));
> $file = $directory . "/" . $file;
> $dir_array[] = preg_replace("/\/\//si", "/", $file);
> }
In the above code, the files found in the subdirectories aren't being
added to $file_array.
>
> When I call this function, the bit of debug code at the end will correctly
> print the array of files I am expecting, and then returns.
Try print "In new dir<br>" and just before the foreach loop to see what
I mean, its finding each file but its not passing what it found to the
calling function.
> foreach ($file_array as $wibble)
> {
> print "Wibble : $wibble <br>\n";
> }
>
> return ($file_array);
> }
Hope that helps,
Tim
Navigation:
[Reply to this message]
|