Chapter 6: CollectionIterator
I got an error when I tried to use the CollectionIterator class - PHP Fatal error: Class CollectionIterator contains 1 abstract methods and must therefore be declared abstract (Iterator::valid) in class.CollectionIterator.php on line 33.
Here is my solution: It looks like the book is using PHP 5.0.0RC2, and I'm using PHP 5.0.4. One of the method names for the Iterator built-in function has changed. The book uses hasMore(), but the correct method name is valid(). If you look at the error message I got, that's what it was telling me (but, I didn't have enough experience to understand it at first).
|