Hello everyone,

Have you used the Iterator class as described in an article in PHPBuilder?

See http://www.phpbuilder.com/columns/bosanac20030225.php3

I get the following error when I try:
php iterator.php

PHP Fatal error: Class ObjectIterator must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0

I'm using PHP 5

Thanks, Rishad

    Not quite sure what is going on in that code example but Iterator is a built-in PHP interface, and so can't be redeclared as a class.

      Ah doh! That class is written for PHP 4. Rename the Iterator class to myIterator or somesuch.

        Write a Reply...