Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [SMARTY] large result sets
> > correct. but i think there is a caveat in php4 with foreach. the 
>
> This is correct. See
> http://www.php.net/manual/en/contro...res.foreach.php for details.

This makes me even less sure I really know what is going on!

According to the foreach docs, foreach works on a copy, therefore it should
make no difference whether or not the array is passed to Smarty as a copy or
by reference, because either way the foreach will create a "new" copy which
it will change.

However, in addition foreach also updates the internal array-pointer, as
Messju points out, so *if* this is considered a change of the array then
we'll now have three copies of essentially the same array.

However (again), my (hazy) recollection is that the array copy will itself
just be a new set of array indexes pointing to references the original data,
unless/until that data changes. So the overall memory usage of this whole
process, assuming a large array, should be little over that used for the
array itself.

This should be semi-trivial to test - create a large array, look at the
memory used, then perform the copy/foreach steps and see how it changes. If
I get chance I might play with this some more, but right now I shouldn't
even really be writing this, I have too much else I should be doing.

--
Mark Rogers,
More Solutions Ltd

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Rogers
08-05-04 02:07 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.