PHP function scan_dir();
January 23rd, 2007 by
Quatrux
As a lot of who knows,PHP5 has a very good function called scan dir, but ash many of use still like to use PHP4 we need to find aletrnatives for it so here is a good function I wrote years ago and want to share it with you
PHP
-
/* #### SCAN DIR ####
-
Input: Directory, 1 to rsort() and files to not index to the Array
-
Output: makes an Array with filenames and dirs on Success or False
-
Status: Complete
-
Last Editor: Quatrux
-
*/
-
-
function scan_dir($dir, $s = ‘0′, $u = ”) {
-
/* Check if input is a Directory and Open it */
-
$u = "**.|..|$u|";
-
/* Don’t add unneeded Files */
-
/* Make an array with all left Files */
-
$d[‘array’][] = $d[‘file’];
-
}
-
}
-
} else {
-
return FALSE;
-
}
-
} else {
-
return FALSE;
-
}
-
/* Check if Directory is not Empty */
-
return FALSE;
-
/* Sort the Array by Request */
-
if ($s == ‘1′) {
-
} else {
-
}
-
}
-
return $d[‘array’];
-
}
Well, will need to find a plugin or something which would highlight the code or something, because now, I don’t even see tabs, oh well.. Stupid Javascript Editor for Wordpress
Posted in PHP | No Comments »