|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-03-02 03:15 UTC] xutian at mail dot transfar dot com
look at the below code:
<?
$handle=opendir('/home/txt/');
$i=0;
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && $file !="0") {
echo $file."<br>";
$i++;
}
}
closedir($handle);
?>
if we have a file named 0 in dir "/home/txt/" and then we creat some other files, the files' list in html will not include files last created.
i think maybe readdir return 0 when it get file who's name equal 0.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 03:00:01 2025 UTC |
yes, "0" evaluates to false so the loop is terminated try while (""!=($file = readdir($handle))) instead, that will do (bug closed until someone comes up with a filesystem where a filename may be all empty)