hi everyone!
i am not sure whether this should be here or in the newbies section... whatever.
i am trying to make a recursive file list, using a recursive function, but i'm not getting any success... seems like the script hangs in some kind of infinite loop. i have a stop-condition to stop the recursion... but the program seems to ignore it... here is the code:
<?php
function recurse_test($directory)
{
echo "--> scanning: ".$directory."\n";
$dir=opendir($directory);
if(!$dir)
{
echo "# opendir not ok\n";
return false;
}
while(($file=readdir($dir))!=false)
{
$temp=$directory."/".$file;
if(!strcmp($file,".") || !strcmp($file,".."))
{
// no go folder
echo "F ".$temp."\n";
continue;
}
if(is_dir($temp))
{
echo "F ".$temp."\n";
recurse_test($temp);
}
else
echo $temp."\n";
}
closedir($dir);
return true;
}
echo "<pre>\n";
$base_dir="/home/klansman";
$base_dir=rtrim($base_dir,"/");
recurse_test($base_dir);
echo "</pre>\n";
?>
could anyone give me a hint on what's wrong?
thank you much in advance! :-)
[]