Home arrow PHP arrow Coding Examples of the Iterator, Countable and ArrayAccess SPL Interfaces in PHP 5

Coding Examples of the Iterator, Countable and ArrayAccess SPL Interfaces in PHP 5

Welcome to the final installment of a series that provides an overview of the Iterator, Countable and ArrayAccess SPL interfaces in PHP 5. Made up of six parts, this series teaches you how to build a fully-working MySQL abstraction class that takes advantage of the methods inherited from these native interfaces to manipulate database record sets easily by using an array syntax.

  1. Coding Examples of the Iterator, Countable and ArrayAccess SPL Interfaces in PHP 5
  2. Review: the MySQLiWrapper and MySQLi_ResultWrapper classes
  3. Putting the MySQLi_ResultWrapper class to work
  4. Final script: counting rows in a result set and accessing specified records
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
April 19, 2010

print this article



In the articles that preceded this one I demonstrated in a step-by-step fashion how to develop such a MySQL handling class. It effectively defined all of the methods required by the aforementioned interfaces. In doing so, the class now is not only capable of traversing data sets by way of a plain “foreach” construct, but it allows you to count and access rows in those sets as if they were array elements.

Of course, while describing the functionality of this sample class is fine, bragging about it is only the half of the story. It's necessary to show a few examples of how to use the class in a useful way. Therefore, in this last part of the series I’m going to code for you a few basic scripts that will show the actual functionality of this implementing class.

Does my proposal sound good to you? Then start reading now!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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: