This function is very similar to PHP5′s scandir(), except that it does not support the $context parameter. To sort in descending order , set $sorting_order to 1.
<?php
if( !function_exists('scandir') ) {
function scandir($directory, $sorting_order = 0) {
$dh = opendir($directory);
while( false !== ($filename = readdir($dh)) ) {
$files[] = $filename;
}
if( $sorting_order == 0 ) {
sort($files);
} else {
rsort($files);
}
return($files);
}
}
?>
The purpose of this function is to enable the use of scandir() in PHP versions prior to PHP5. It is “future compatible”, so you don’t have to worry about anything breaking when you upgrade to PHP5.
Deceptively similar to http://php.net/scandir
Dan.
Could you post the code what it would look like if you used the opendir() function instead of the scandir() function in the jqueryFileTree.php file from you previous article ?
I’m new to scripting and can’t seem to get it done…
Your help is much appreciated !
John, see Example #1 at http://php.net/opendir
I owe you a drink or two! Thanks a million.