I have been writing some code that visits each directory stored within one directory in turn, pics a random image from it and displays that image. I have the code working fine, apart from one small quirk that I can't really understand. In one version of the implementation, the directories appear to be getting accessed in the order they are uploaded to / edited on the server starting with the most recent upload/change - which is handy because it is what I wanted. But in another slightly different version of the same bit of code, it lists them in some weird order that I can't fathom. I suppose my question put simply is, what is the default ordering of directories when PHP uses the readdir method? And is there anyway to force a specific ordering to the directories before PHP searches down them? Any help would be greatly appreciated. Regards, Toby