1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <?php /** * https://github.com/php/php-src/pull/1026 * https://wiki.php.net/rfc/incompat_ctx */ class A { function bNon() { //i'm not interested in this echo "A::bNon\n"; } static function cStat() { if (isset($this)) { //static method has been called non-statically //$this is instance of A echo "$a->cStat\n"; } else { //static method has been called statically echo "A::cStat\n"; } } } //this should fail, that's fine A::bNon(); //but this should work both: A::cStat(); $a = new A(); $a->cStat(); ?> |