Re: Reference or copy?

From: Date: Wed, 23 Jul 2008 16:43:58 +0000
Subject: Re: Reference or copy?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-277197@lists.php.net to get a copy of this message
On Wed, 2008-07-23 at 01:21 -0700, Ted Wood wrote: > On 23-Jul-08, at 1:19 AM, Ted Wood wrote: > > > > So PHP waits until a copy is actually needed before it makes one. > > Explicitly making copies incurs overhead because of the concept of > > "reference counting". So again, don't use references for performance > > reasons. > > > That should've been: Explicitly making "references", not copies... This only applies to PHP5. PHP4's Copy-On-Write (COW) for objects was crap and would clone the object on assignment. It was especially bad when looping over an array of objects since each would be cloned so you usually had to loop over the keys of the array and pull out a reference yourself. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP

« previous php.general (#277197) next »