1

I am trying to understand LSB in php and stumbled on to this late static binding in PHP.I don't understand how $this and static:: are resolved in the example. A::test() has both $this->foo() and static::foo().

Here is my current understanding.
1) $this refers to calling object in non static context.
2)static:: refers to calling class in static context.

Now b->test() should contain b->foo()(this should actually fail?) and c->test() should contain c->foo() for their corresponding $this->foo(). Or to put it in another way, how does $this behave in inherited method? Finally, how does static:: behave in non static context?

ajith.mk
  • 75
  • 8

0 Answers0