Re: $this->value VS $value
| From: | Colin Guthrie | Date: | Tue, 23 Sep 2008 17:20:21 +0000 |
| Subject: | Re: $this->value VS $value | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280798@lists.php.net to get a copy of this message | ||
Nathan Rixham wrote:
yeah that's right; add in one more line and the reason why is apparent..Well I think "is apparent" is a bit strong considering e.g. C++ syntax where syntax is equally valid but the semantics are different. So to answer the OPs question, yes this is different in PHP compared to other languages. I think this is due to the fact that classes are kinda bolted on in PHP and there isn't really such a thing as "being in a class" in terms of scoping. $this is allows the class scope to be kind of emulated inside a functional scope. I could be wrong here, but that's my understanding of it. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]