Reply to Re: [PHP] Re: Strange notation to create object

Your name:

Reply:


Posted by Matthew Weier O'Phinney on 06/24/05 20:53

* Robert Cummings <robert@interjinn.com> :
> 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@garden.org | http://vermontbotanical.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация