note 129995 added to function.readdir
| From: | php.morbin-123@spamgourmet.com | Date: | Wed, 22 Jan 2025 18:52:52 +0000 |
| Subject: | note 129995 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221811@lists.php.net to get a copy of this message | ||
This check:
<?php
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "$entry\n";
}
}
closedir($handle);
}
?>
Can be simplified as:
<?php
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry[0] != ".") {
echo "$entry\n";
}
}
closedir($handle);
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 199.34.0.250)
----
Manual Page -- https://php.net/manual/en/function.readdir.php
Edit -- https://main.php.net/note/edit/129995
Del: integrated -- https://main.php.net/note/delete/129995/integrated
Del: useless -- https://main.php.net/note/delete/129995/useless
Del: bad code -- https://main.php.net/note/delete/129995/bad+code
Del: spam -- https://main.php.net/note/delete/129995/spam
Del: non-english -- https://main.php.net/note/delete/129995/non-english
Del: in docs -- https://main.php.net/note/delete/129995/in+docs
Del: other reasons-- https://main.php.net/note/delete/129995
Reject -- https://main.php.net/note/reject/129995
Search -- https://main.php.net/manage/user-notes.php