Re: DB_DataObject - using foreach instead of while

From: Date: Mon, 21 Aug 2006 18:32:44 +0000
Subject: Re: DB_DataObject - using foreach instead of while
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24930@lists.php.net to get a copy of this message
On 8/21/06, Noel da Costa <noel.dacosta@magharl.co.uk> wrote:
Hi there, The syntax examples for DB_DataObject show how to use a while loop with ->fetch() to iterate over records. Is there a way of doing this using a foreach loop instead? I'm trying to optimize speed here.
How would foreach be better than while? foreach uses a copy of an array to loop over it. No, there is, of course, no way to do this as ->fetch() gets one record at a time. -- Justin Patrin

« previous php.pear.general (#24930) next »