Re: Re: Strange notation to create object

From: Date: Fri, 24 Jun 2005 02:16:41 +0000
Subject: Re: Re: Strange notation to create object
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-217530@lists.php.net to get a copy of this message
Robert Cummings wrote:
On Thu, 2005-06-23 at 13:36, Matthew Weier O'Phinney wrote:
* Robert Cummings <robert@interjinn.com> :
On Thu, 2005-06-23 at 11:32, Matthew Weier O'Phinney wrote:
     
The above notation is unnecessary when developing in PHP5, as objects in PHP5 are passed by reference by default. However, in PHP4, this was
       
Not entirely, there's still a subtle difference in PHP5 between assigning an object with = versus assigning with = &.
     
Would you mind explaining the difference? I've seen nothing in the docs, to indicate that assigning objects with =& in PHP5 is necessary, or even desired. My experience with PHP5 hasn't shown this either. I'd be interested to know to what you refer.
See for yourself when running the following script: Cheers, Rob. I am stunned! Since I try to make my code working for both PHP4 and PHP5 I try to never rely on PHP4's standard cloning behaviour, and use & where I can, so I have never really encountered this, but this will propably save my a lot of frustration when the rest of the world says goodbye to PHP4. (I remember when I first encountered the 'references in constructor'-issue) excellent stuff! grt, Evert

« previous php.general (#217530) next »