Re: Re: Strange notation to create object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Robert Cummings <robert@xxxxxxxxxxxxx> :
> On Fri, 2005-06-24 at 10:02, Jason Barnett wrote:
> > Robert Cummings wrote:
> > ...
> > > There's a difference between a reference to a reference and a copy of a
> > > reference *hehehe*.
> > 
> > Now that makes sense.  And am I correctly filling in the blanks when I 
> > guess that $foo3 = $aObj is merely copying the reference instead of 
> > referencing the reference?  I probably could have written that more 
> > clearly, but I think you get what I'm saying.
>
> Yeah, *grin*. And on that note, there are times when you will actually
> want $foo = &new SomeClass(); versus $foo = new SomeClass(); since
> assigning by reference will break any previous references -- something I
> forgot to mention to Matthew Weier when he challenged the relevance of
> the snippet I sent.

Funny... I just ran into that last night as I was writing some unit
tests for an app that uses PEAR_ErrorStack! I was unsetting the object,
but that only unset the reference to it -- and so the singleton
reference that PEAR_ErrorStack created was still available when I
instantiated a new object -- which meant previous errors were still
present in the object. 

So, I stand corrected; I've seen it now!

Good discussion!

-- 
Matthew Weier O'Phinney           | WEBSITES:
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org
mailto:matthew@xxxxxxxxxx         | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux