In this example it first searches in B (because static::
resolves to B) and as it does not find it, it now searches in "A" and that is why it succeeds, right? or am I wrong?
class A {
private function foo() {
echo "success!\n";
}
public function test() {
$this->foo();
static::foo(); // Why does it execute method of "A" if static:: be resolved to "B"?
}
}
class B extends A {
/* foo() will be copied to B, hence its scope will still be A and
* the call be successful */
}
$b = new B();
$b->test();
OUTPUT:
success! success!