note 77406 deleted from language.oop.newref by danbrown
| From: | danbrown@php.net | Date: | Sat, 07 Nov 2009 19:11:00 +0000 |
| Subject: | note 77406 deleted from language.oop.newref by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162580@lists.php.net to get a copy of this message | ||
Note Submitter: mentepollo phpero
----
Continuing aib's note (31-May-2006 11:20) on the new behavior of PHP 5.x:
Not only the "new" operator now returns a reference of the object (instead of a copy of
the object as in PHP4), but more importantlly: now the assignment operator when acting on objects
assigns by reference not by value.
This means operator =& is equal to operator = , but only when acting on objects. If you want to
copy (clone) an object use: $B = clone $A;
Java creators got it right from the begining :)