DanDaBeginner Posted May 25, 2007 Share Posted May 25, 2007 i'm just wondering how readdir behave.. does readdir reads the file according to the modified date time? when I used readdir I noticed that it reads the file according to modified date time - and also why there's a dot '.' included to the filename that have been read? heres the code <?php if ($open = opendir('myFiles/')) { while ($file = readdir($open)) { echo $file.'- <br>'; } closedir($open); } ?> output: .- ..- file1.wmv- file2.wmv- file3.wmv- file4.wmv- file5.wmv- file6.wmv- --------------- why there is dot in the output? Quote Link to comment https://forums.phpfreaks.com/topic/52928-solved-readdir-help/ Share on other sites More sharing options...
jitesh Posted May 25, 2007 Share Posted May 25, 2007 Try like this while (false !== ($file = readdir($handle))) { echo "$file\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/52928-solved-readdir-help/#findComment-261361 Share on other sites More sharing options...
DanDaBeginner Posted May 25, 2007 Author Share Posted May 25, 2007 thanks.. but - ??? still theres a dot... and also: does readdir reads the file according to the modified date time? Quote Link to comment https://forums.phpfreaks.com/topic/52928-solved-readdir-help/#findComment-261370 Share on other sites More sharing options...
jitesh Posted May 25, 2007 Share Posted May 25, 2007 it returns the filename of the next file from the directory. The filenames are returned in the order in which they are stored by the filesystem. Quote Link to comment https://forums.phpfreaks.com/topic/52928-solved-readdir-help/#findComment-261372 Share on other sites More sharing options...
DanDaBeginner Posted May 25, 2007 Author Share Posted May 25, 2007 thanks.. I overlooked the manual..I saw it now... Quote Link to comment https://forums.phpfreaks.com/topic/52928-solved-readdir-help/#findComment-261387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.