Re: References - good or bad

From: Date: Sat, 29 Dec 2001 00:20:49 +0000
Subject: Re: References - good or bad
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-75229@lists.php.net to get a copy of this message
Andi Gutmans wrote:
As I mentioned on the ZE2 mailing list there general rule of thumb is: a) Objects should be passed by reference. b) Everything else including arrays should be used by value whenever possible semantically. In the ZE2 objects will join b).
Is there a proposed sytnax to stop copy by reference (Or did i miss it in the ZE2 docs) old stuff $object_copy = $object; //(copy) $object_copy = &$object; //(copy reference) new stuff? $object_copy = copy_object($object); //(copy????) $object_copy = $object; //(copy reference) regards alan
Basically what this means, as long as you're not changing the data passing it by value will take the full advantage of reference counting. Andi


« previous php.dev (#75229) next »