PHP 8.5.0 Alpha 1 available for testing

Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

mstabile75 at gmail dot com
19 years ago
In my previous post I ran into a problem with the "global" definition of $directorylist. If I called the function more than once on the same page it would combine the file lists. I looked at Lasse Dalegaard's example and used the following solution.

remove global definition
global $directorylist;

REPLACE
<?
if ((($maxlevel) == "all") or ($maxlevel > $level)) {
filelist($startdir . $file . "/", $searchSubdirs, $directoriesonly, $maxlevel, $level + 1);
}
?>
WITH
<?
if ((($maxlevel) == "all") or ($maxlevel > $level)) {
$list2 = filelist($startdir . $file . "/", $searchSubdirs, $directoriesonly, $maxlevel, $level + 1);
if(is_array($list2)) {
$directorylist = array_merge($directorylist, $list2);
}
}
?>

<< Back to user notes page

To Top