News Feed
Jobs Feed
Sections



Recent Jobs

News Archive
Sean Coates' Blog:
A Case of Mistaken Iterator
July 29, 2010 @ 12:48:51

In a new post to his blog today Sean Coates talks about some of his work with Iterators in PHP and how, despite a bad example in the manual, he solved his issue (and updated the PHP manual too).

In the back end, we have models that connect to CouchDB. These models implement the Iterator pattern to allow easy traversal of a record's keys. [...] Little did I realize that this implementation is very broken. [...] Over the past few years, I've implemented many iterators in this way, using PHP's implicit array manipulation functions (reset(), current(), key(), next()).
He points out some issues with how PHP handles array index tracking and how, in the previous PHP manual example, it incorrectly checked for "false" against the current array value. His updated version doesn't have this issue. You can see it here.

0 comments voice your opinion now!
iterator mistake manual update



Similar Posts

Christopher Jones' Blog: Time for testing the final PHP 5.2 release

Zend Developer Zone: Zend Technologies Updates Zend Core

Derek Allard's Blog: Getting changes made to the CodeIgniter manual

DevShed: Handling Entries for a Blogger Built with PHP

Community News: Livedocs XMLWriter Entry Updated


Community Events

phpnw10 PHP Conference 09/10/2010




Don't see your event here?
Let us know!


symfony wordpress codeigniter book example tool development suggestion unittest podcast opinion framework phpunit plugin zendframework azure application database developer conference

All content copyright, 2010 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework