Re: [SMARTY] large result sets

From: Date: Wed, 04 Aug 2004 16:48:05 +0000
Subject: Re: [SMARTY] large result sets
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11663@lists.php.net to get a copy of this message
On Wed, Aug 04, 2004 at 05:35:04PM +0100, Mark Rogers wrote: > > You can use assign_by_ref() instead of plain old assign to use a > > reference, so you have one copy of the data instead of two. > > There should be no difference, unless either the original or the copy is > subsequently changed (which is unlikely in a template variable). PHP > maintains copied variables as references until their values diverge. correct. but i think there is a caveat in php4 with foreach. the internal array pointer (http://php.net/current) is a property of the assigned array. if you do foreach($array as $item), the internal array-pointer gets reset. this is considered a change of the array and the whole thing gets copied. i didn't look for evidence of that in the php-source, but memory-consumption with foreach on large arrays makes me assume that. it would be great if anybody could confirm or rebut this. > -- > Mark Rogers, > More Solutions Ltd :: Tel: 0845 45 89 555 > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#11663) next »