Re: Object References Problem
| From: | Gareth Williams | Date: | Fri, 31 Oct 2003 07:27:09 +0000 |
| Subject: | Re: Object References Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168212@lists.php.net to get a copy of this message | ||
Boyan, Michael and Mike,
Thanks for the help, I now understand what is going on, and you guys have saved me from pulling my hair out in frustration.
I'm more used to doing OOP in Delphi and Perl, and the peculiarities of PHP are somewhat confusing.
Once again, thanks for the help.
On Friday, Oct 31, 2003, at 03:03 Europe/Amsterdam, Mike Migurski wrote:
I don't pretend to fully understand PHP references, or the strange and mysterious ways that they work in regards to PHP objects, but I can tell you how to acheive the results you desire. Someone else will have to explain it. :)<snip>If someone sees that I'm leading Gareth astray here, feel free to jump in and correct me...Your explanation squares with my experience. My understanding from dealing with some fairly complex OOP interactions is that PHP operators generally favor passing-by-value to passing-by-reference, and the underlying language engine is optimized to perform well under those circumstances. Which is great, if you're new to programming, have never used Java or C, and are tossing arrays around and don't want to be bothered with premature optimization, but it's a royal pain when you need to maintain some degree of referential integrity. I frequently find myself using '&' all over the place to cut down on accidental returns-by-value. I have not yet had a chance to play with PHP5's beta versions, but its strong focus on OOP makes me wonder, what kind of language changes (if any) were required to help ease this situation? -mike. --------------------------------------------------------------------- michal migurski- contact info and pgp key:sf/ca http://mike.teczno.com/contact.html-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php