Re: unsetting object references

From: Date: Wed, 17 Apr 2002 20:20:01 +0000
Subject: Re: unsetting object references
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93391@lists.php.net to get a copy of this message
Erik Price wrote: > > On Wednesday, April 17, 2002, at 03:59 PM, Robert Cummings wrote: > > > Now if what you meant was the following: > > > > $objectFoo = new MyObject(); > > $objectFee = &$objectFoo; > > > > unset( $objectFoo ); > > > > Then the object shouldn't be deleted since $objectFee is still > > referencing > > it. You will just break the reference. Correct me if I'm wrong *chuckle* > > What if I did > > $objectFoo = new MyObject; > $objectFee = $objectFoo; > > unset($objectFoo); > > essentially, does PHP make a (deep|shallow) copy of an object in this > reassignment, or is it just creating a new reference? Should be a copy, and it should be safe... though I recall a discussion last week that displayed an interesting bug (feature?). Cheers, Rob. -- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummings@webmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'

« previous php.general (#93391) next »