Sean Coates schrieb: >> how can i check if a method is called statically when called from inside >> another object? (without debug_bactrace()) > > <plug > type="own">http://blog.phpdoc.info/archives/4-Schizophrenic-Methods.html</plug> > > Short answer: > $isStatic = !(isset($this) && get_class($this) == __CLASS__);
i know this hack, but it does not work, if the statically called method is from the same class as the calling object class foo { function bar() { if ( isset( $this ) && get_class( $this ) == __CLASS__ ) { return 'not static'; } return 'static'; } function bar2() { return foo::bar(); } } // returns 'static' echo foo::bar(); // returns 'not static' but should be 'static' $foo = new foo; echo $foo->bar2(); -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php