note 73062 deleted from function.scandir by cmb
| From: | cmb@php.net | Date: | Sun, 17 Nov 2019 09:04:27 +0000 |
| Subject: | note 73062 deleted from function.scandir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213116@lists.php.net to get a copy of this message | ||
Note Submitter: aryel at redtwilight dot com dot br
----
This function is similar to scandir, but works in PHP4. It uses readdir to get directory info.
<?php
function php4_scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != "..") || $skipDots == true) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}
?>