At 08:20 AM 12/29/2001 +0800, Alan Knowles wrote:
>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)

To copy around a reference you will just use it as a regular value. Like in 
your second example, i.e.:
$same_object = $object;
Basically you're just copying the object handle and not the object itself.

In order to create a real copy (with a new object handle) you'll do:
$new_object = $object->__clone();

Andi


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to