note 106685 added to function.readdir
| From: | williamcomartin at gmail dot com | Date: | Mon, 28 Nov 2011 15:20:53 +0000 |
| Subject: | note 106685 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184740@lists.php.net to get a copy of this message | ||
A function i made to read the array and check if the file exist in an array great for testing
against a db to find files in a folder that arent already logged
function read_dir($dir, $array = array()){
$dh = opendir($dir);
$files = array();
while (($file = readdir($dh)) !== false) {
$flag = false;
if($file !== '.' && $file !== '..' && !in_array($file,
$array)) {
$files[] = $file;
}
}
return $files;
}
----
Server IP: 216.235.13.26
Probable Submitter: 68.179.41.129
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- https://master.php.net/note/edit/106685
Del: integrated -- https://master.php.net/note/delete/106685/integrated
Del: useless -- https://master.php.net/note/delete/106685/useless
Del: bad code -- https://master.php.net/note/delete/106685/bad+code
Del: spam -- https://master.php.net/note/delete/106685/spam
Del: non-english -- https://master.php.net/note/delete/106685/non-english
Del: in docs -- https://master.php.net/note/delete/106685/in+docs
Del: other reasons-- https://master.php.net/note/delete/106685
Reject -- https://master.php.net/note/reject/106685
Search -- https://master.php.net/manage/user-notes.php