PHP
  Home arrow PHP arrow Iterators in the Simplest Sense: An Accessible Implementation in PHP 4
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

Iterators in the Simplest Sense: An Accessible Implementation in PHP 4
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2006-03-08


    Table of Contents:
  • Iterators in the Simplest Sense: An Accessible Implementation in PHP 4
  • What is an Iterator? defining the core concepts
  • Building in an Iterator in PHP 4: setting up a functional example
  • Deriving subclasses from the base Iterator: building an array Iterator class

  • 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


    Iterators in the Simplest Sense: An Accessible Implementation in PHP 4
    ( Page 1 of 4 )

    In this first article of a series, Alejandro Gervasio explains the core concepts of Iterators in PHP, concentrating most of his efforts on the subject’s practical side.

    Introduction

    Design Patterns are, in my humble opinion, a very large and complex topic within the universe of software engineering, and certainly when applied particularly to PHP programming, they’re not the exception to the rule. If you’re making your first leaps into the theory and practical implementation of Design Patterns, you may find some of them easier to learn, while others might be harder to grasp, which simply means you'll need to take more time to master their concepts.

    In either case, learning Design Patterns doesn’t have to be a boring and annoying experience which must be avoided at all costs. Indeed, it’s possible to introduce the topic in a friendly way, without appealing to complex definitions or including a lot of buzzwords that may eventually lead you to think erroneously that Design Patterns are out of reach of the average PHP programmer.

    However, as you probably know, Design Patterns are a huge topic, which unfortunately can't be appropriately covered in a few short articles. Bearing in mind this limitation, I’ll start to teach you about Patterns by explaining some of the theory related to the Iterator pattern; at the same time (here’s where things can be interesting for you), I will emphasize its concrete implementation through some specific PHP hands-on examples, which can be quite useful for larger PHP applications.

    Here, I’m not going to offer a full reference for what each design pattern is. You can buy a book to learn that, or even do some “googling” and find other helpful resources that probably will treat the subject much more extensively. Instead, I’ll provide you with a concise explanation of what an Iterator is, in conjunction with numerous sample codes, which hopefully will help you understand much more easily how it can applied in PHP object-oriented programming.

    After introducing the subject of this series, it’s time to move on and begin learning how the Iterator pattern can work for you. Ready to work with Iterators? Right, let’s get started.



     
     
    >>> 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 2 hosted by Hostway
    Stay green...Green IT