madrazel
04-23-2007, 12:52 PM
i wrote this monster :cool: :
function dirdir($x) {
$cwd= getcwd(); $x = strtr($x,"\\","/");
if (stripos($x,"/")) {
$fil = substr(strrchr($x,"/"),1,strlen($x));
$dir = substr($x,0,strlen($x)-strlen($fil));
} else { $dir = $cwd; $fil = $x;};
chdir($dir);
foreach ( glob($fil) as $file ) {
if (!is_file(getcwd()."/".$file)) continue;
$files[]=$file; }
chdir($cwd);
if (@!is_array($files)) return FALSE;
sort($files); return $files; };
//print_r(dirdir("d:\somedir\somedir\*.php"));
do you have any ideas or tips that i can use here, to make it faster or maybe add some simple feature ?
did i make something wrong here ? :confused:
function dirdir($x) {
$cwd= getcwd(); $x = strtr($x,"\\","/");
if (stripos($x,"/")) {
$fil = substr(strrchr($x,"/"),1,strlen($x));
$dir = substr($x,0,strlen($x)-strlen($fil));
} else { $dir = $cwd; $fil = $x;};
chdir($dir);
foreach ( glob($fil) as $file ) {
if (!is_file(getcwd()."/".$file)) continue;
$files[]=$file; }
chdir($cwd);
if (@!is_array($files)) return FALSE;
sort($files); return $files; };
//print_r(dirdir("d:\somedir\somedir\*.php"));
do you have any ideas or tips that i can use here, to make it faster or maybe add some simple feature ?
did i make something wrong here ? :confused: