On Mon, Jun 03, 2002 at 10:29:19AM +0300, Michael Stolovitzsky wrote :
> If I understand correctly, given $bar is an object
>
> $foo = $bar
>
> will copy entire contents of $bar into foo. Following question: what happens
> with $foo = new Foo? Does the object get created, copied into $foo and then
> destroyed, while the copy in $foo lives?
>
> In other words, is there a performance benefit to do $foo =& new Foo?
No, it's exactly the other way around with objects, you get a
slight performance penalty (though it may no be noticeable at
all).
Currently, not useing the '&' operator will always create a
new (shallow) copy of the objects.
This is already addressed with the new Zend Engine 2 which
will behave as expected (objects aren't copied, they stay
atomic until explicitely duplicated [cloned]).
- Markus
--
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
Did I help you? http://guru.josefine.at/~mfischer/wishlist_en
Konnte ich helfen? http://guru.josefine.at/~mfischer/wishlist_de
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php