note 83192 added to function.scandir
| From: | russellatrussellfinlaydotcom at osu1 dot php dot net | Date: | Wed, 14 May 2008 19:14:46 +0000 |
| Subject: | note 83192 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139390@lists.php.net to get a copy of this message | ||
A little snippet of code that will remove any files beginning with '.'
Good for removing '.' and '..' as well as any other hidden files.
Resulting array is $files
<?php
$dir = '.';
$files = scandir($dir);
foreach($files as $i => $value) {
if (substr($value, 0, 1) == '.') {
unset($files[$i]);
}
}
?>
----
Server IP: 92.48.74.199
Probable Submitter: 81.79.69.15
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- https://master.php.net/note/edit/83192
Del: integrated -- https://master.php.net/note/delete/83192/integrated
Del: useless -- https://master.php.net/note/delete/83192/useless
Del: bad code -- https://master.php.net/note/delete/83192/bad+code
Del: spam -- https://master.php.net/note/delete/83192/spam
Del: non-english -- https://master.php.net/note/delete/83192/non-english
Del: in docs -- https://master.php.net/note/delete/83192/in+docs
Del: other reasons-- https://master.php.net/note/delete/83192
Reject -- https://master.php.net/note/reject/83192
Search -- https://master.php.net/manage/user-notes.php