<?php class Foo { static function Bar() { if (isset($this) && isset($this->bar)) { echo "isset\n"; } var_dump($this); } } Foo::Bar(); $obj = new Foo(); $obj->Bar();
<?php require "ns_027.inc"; class Foo { function __construct() { echo __CLASS__, "\n"; } static function Bar() { echo __CLASS__, "\n"; } } $x = new Foo(); Foo::Bar(); $x = new Foo\Bar\Foo(); Foo\Bar\Foo::Bar();
<?php class Foo { function Bar() { $__this = $this; $this = null; debug_backtrace(); $this = $__this; } } $f = new Foo(); $f->Bar(); echo "OK\n";