The natural introspective abilities that were included with the "DirectoryIterator" class allow you, among other things, to determine whether a given directory entry is "." or ":". This checking process can be easily performed by using the "isDot()" method, which has been utilized in the example below. Please examine its source code: $dirProc=new DirectoryIterator('default_path/'); In this case, the above code snippet illustrates in a friendly fashion how to use the "isDot()" method, in order to determine whether the current directory element is "." or ":". Regarding the results outputted by this example, they're listed below: Current element is "." or ":" and its path is the following : default_path/. Assuming that you had no major problems understanding the previous example, I'm pretty sure that you're starting to realize the great introspective capabilities natively exposed by the "DirectoryIterator" class. They're indeed remarkable! Okay, now that you know how the "isDot()" method works, let's leap forward quickly and look at three new methods that belong to the "DirectoryIterator" class, which also use introspection to determine whether a specific directory entry is readable, writable and executable. Sounds really interesting, right? Therefore, I recommend you read the following section to find out how the methods that I mentioned before can be put to work.
blog comments powered by Disqus |