PHP's magic method __call on subclasses
问题 My situation is best described with a bit of code: class Foo { function bar () { echo "called Foo::bar()"; } } class SubFoo extends Foo { function __call($func) { if ($func == "bar") { echo "intercepted bar()!"; } } } $subFoo = new SubFoo(); // what actually happens: $subFoo->bar(); // "called Foo:bar()" // what would be nice: $subFoo->bar(); // "intercepted bar()!" I know I can get this to work by redefining bar() (and all the other relevant methods) in the sub-class, but for my purposes, it