Re: Are PHP5 features worth it?

From: Date: Wed, 20 Dec 2006 11:05:29 +0000
Subject: Re: Are PHP5 features worth it?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-246068@lists.php.net to get a copy of this message
On Wed, 2006-12-20 at 11:49 +0100, Jochem Maas wrote: > > > > How about iterators? You can have objects that look like arrays yet they take > > much less memory: > > > > $rs = $db->query($select); # query the db > > foreach ($rs as $row) { # fetch the row > > whatever($row); > > } > > ah yes - good catch, I do like iterators for keeping code nice and tight. I don't what you guys did in PHP4, but I do the following: <?php if( $db->query( $query ) ) { while( ($row = $db->fetchRow()) ) { whatever( $row ); } } ?> I fail to see the need for an iterator. But, I'll grant you, proper destructor support is nice. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#246068) next »