On Thu, Aug 07, 2003 at 03:57:16AM -0500, Daryl Meese wrote:
> $this->_____ is a well known reference method supported in a large number of
> languages: php, javascript, and java for example.  Feel free to use it
> without reservation (IMHO) because it should be there forever.

i know that. i mean the special case:

$a = FooClass::foo();  // inside foo() there is no $this
[there is no $this in nearly any languange on this planet in a *static* method]

but in php, if i do the same call:
$a = FooClass::foo();

from inside a method of an object that is not necessarily a member of
the FooClass, nontheless FooClass::foo() knows $this as a reference to
an object (the calling object).

that *is* special. and i don't know a language that behaves in that
way except of php. but i know this way can have it's merits, though,
that's why i asked.

greetings
messju
 
> Daryl
> 
> -----Original Message-----
> From: messju mohr [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 07, 2003 3:42 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] static method and $this
> 
> 
> hello php-general,
> 
> i found this thread in the mailing-list archive:
> http://marc.theaimsgroup.com/?l=php-general&m=104182777004472&w=2
> 
> to summarize: if you call a static method FooClass::foo() from within
> an object-method (for example:
> 
> class BarClass {
> 
>   function bar() {
>     Foo::foo();
>   }
> 
> }
> $obj = new BarClass;
> $obj->bar();
> 
> )
> 
> 
> FooClass::foo() will have a reference "$this" defined that is a
> reference to $obj.
> 
> 
> i noticed recently that this still works in the beta1 of php5.
> 
> my question: does anybody have a clue if this is a well-known and
> supported feature? or is it just a side-effect and using it can be a
> bad design-decision in the long run?
> 
> greetings
> messju
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to