Jump to content

Help with a PHP script please


jamesl2222

Recommended Posts

Hi guys,  whilst the script works  fine on  files..
I need to return the directory name instead  .
Can anyone help

function adir2($dirname2) {
$handle2=opendir($dirname2);
$dirarray2 = array();
while ($file2 = readdir($handle2))
{
if ($file2 > "..") {array_push($dirarray2,$file2);}
}
closedir($handle2);
return $dirarray2;
}

function randdir2($dirname2)
{
srand ((double) microtime() * 10000000);
$dirarray2 = adir2($dirname2);
$rndfile2 = array_rand($dirarray2);
return $dirarray2[$rndfile2];
}

function print_array2($array) {
if(gettype($array2)=="array") {
echo "<ul>";
while (list($index, $subarray) = each($array) ) {
echo "<li>$index <code>=&gt;</code> ";
print_array($subarray);
echo "</li>";
}
echo "</ul>";
} else echo $array;
}

Link to comment
https://forums.phpfreaks.com/topic/33083-help-with-a-php-script-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.