Home arrow PHP arrow Iterators in the Simplest Sense: An Accessible Implementation in PHP 4

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

TABLE OF CONTENTS:
  1. Iterators in the Simplest Sense: An Accessible Implementation in PHP 4
  2. What is an Iterator? defining the core concepts
  3. Building in an Iterator in PHP 4: setting up a functional example
  4. Deriving subclasses from the base Iterator: building an array Iterator class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 8
March 08, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: