PHP
  Home arrow PHP arrow Using Introspective Methods with the DirectoryIterator Class in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Using Introspective Methods with the DirectoryIterator Class in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2006-09-25


    Table of Contents:
  • Using Introspective Methods with the DirectoryIterator Class in PHP 5
  • The isDir() method
  • Using the isDot() method
  • Implementing the isExecutable(), isReadable() and isWritable() methods
  • The getPerms() and getType() methods

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Using Introspective Methods with the DirectoryIterator Class in PHP 5
    ( Page 1 of 5 )

    If you’re one of those PHP developers who want to explore the package of classes that come bundled with the Standard PHP Library (SPL), then fear not, because you’re at the right place. Welcome to the concluding part of the series "A Close Look at the DirectoryIterator Class in PHP 5." In three parts, this series introduces the most important methods attached to this class, and shows you how to use them by mean of extensive hands-on examples.

    Introduction

    After this short introduction, allow me to recapitulate briefly the topics that I covered in the two previous articles. This will conveniently refresh your memory and get you back into the flow of the contents of this series.

    As you'll probably remember, over the course of the first article, I took an in-depth look at some of the core methods included within the "DiretoryIterator" class to demonstrate how a specified directory can be quickly traversed by a regular "foreach" language construct. In all the code samples that you saw, once an instance of the iterator class was properly created, the process for iterating over several directory entries was simplified to using the mentioned loop structure, in conjunction with a conventional array notation.

    Aside from depicting the entire process for traversing a given directory and accessing each of its elements, in the second part of this series, strong emphasis was put on covering some of the most relevant methods that come with the "DirectoryIterator" class. In accordance with this, you learned how to do all sorts of clever things, like finding paths and names of directory entries, as well as handling the corresponding timestamps.

    Perhaps you think that after having examined all the methods that I mentioned before, the tale of the "DirectoryIterator" class was already concluded. Well, not so fast; this class still has some additional methods that require special attention. For this reason, this last tutorial of the series will be focused mostly on covering all the methods related to performing some kind of introspective process, which can be quite useful when analyzing the types and permissions of each entry included in a given directory.

    Having established the goals of this tutorial, let's get started. Hopefully, this will be an educational experience!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT