Re: Re: Strange notation to create object
| From: | Jason Barnett | Date: | Fri, 24 Jun 2005 20:06:18 +0000 |
| Subject: | Re: Re: Strange notation to create object | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217575@lists.php.net to get a copy of this message | ||
Robert Cummings wrote:
...
This is intentional behaviour, there are times when you want a copy of a reference and there are times when you want a reference to a reference. For instance consider the following: $foo1 = $foo2 = $foo3 = new a(); $foo2 = new b(); If these were references to references instead of copies of references then $foo1, $foo2, and $foo3 would all now refer to the newly created b object. Cheers, Rob.OK I'm pretty clear on it, but now I wonder: is variable assignment (=) the only place where the Zend Engine will copy a reference instead of reference the reference? -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php