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. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php