On Sun, Oct 12, 2014 at 12:10 PM, Nikita Popov wrote:
> On Sun, Oct 12, 2014 at 10:37 AM, Robert Stoll wrote:
>
>> Hey,
>>
>>
>>
>> I just stumbled over a method call of a non-static method with self and
>> was asking myself again, why does PHP support
>> this behaviour. An example to outline wh
On 26 October 2014 19:55, Marc Bennewitz wrote:
>
> On 12.10.2014 12:10, Nikita Popov wrote:
> > On Sun, Oct 12, 2014 at 10:37 AM, Robert Stoll wrote:
> >
> >> Hey,
> >>
> >>
> >>
> >> I just stumbled over a method call of a non-static method with self and
> >> was asking myself again, why does
On 12.10.2014 12:10, Nikita Popov wrote:
> On Sun, Oct 12, 2014 at 10:37 AM, Robert Stoll wrote:
>
>> Hey,
>>
>>
>>
>> I just stumbled over a method call of a non-static method with self and
>> was asking myself again, why does PHP support
>> this behaviour. An example to outline what I am writi
On Sun, Oct 12, 2014 at 10:37 AM, Robert Stoll wrote:
> Hey,
>
>
>
> I just stumbled over a method call of a non-static method with self and
> was asking myself again, why does PHP support
> this behaviour. An example to outline what I am writing of:
>
>
>
> class A{
>
> function foo(){
>
>
> In your given example, $this is defined when A::bar() is called;
> interestingly, when this class is extended it will
still only call
> A::bar() as opposed to calling $this->bar(). Whether this is useful behaviour
> is irrelevant :)
>
Right, I completely forgot that. So calling it with self
On 12 Oct 2014, at 16:37, Robert Stoll wrote:
> Hey,
>
>
>
> I just stumbled over a method call of a non-static method with self and was
> asking myself again, why does PHP support
> this behaviour. An example to outline what I am writing of:
>
>
>
> class A{
>
> function foo(){
>
>
Hey,
I just stumbled over a method call of a non-static method with self and was
asking myself again, why does PHP support
this behaviour. An example to outline what I am writing of:
class A{
function foo(){
self::bar();
}
function bar(){}
}
IMO it should not be allowed