<?php $x[] .= C::b([], [], []);
} abstract class D implements FooBar, Boo { } class C extends D { public function f() { echo "f\n"; } public function b() { echo "b\n"; } public function fb() { echo "fb\n"; } public function o() { echo "o\n"; } } $c = new C(); $c->f(); $c->b(); $c->fb(); $c->o(); echo Foo::x . "\n"; echo FooBar::x . "\n"; echo C::x . "\n";
<?php trait A { public function b() { return function () { return array(__CLASS__, get_class($this)); }; } } class C { use A; public function d() { return function () { return array(__CLASS__, get_class($this)); }; } } $c = new C(); $b = $c->b(); var_dump($b()); $d = $c->d(); var_dump($d());