4 public static $x = 'in Y (static)';
5 public $y = 'in Y (instance)';
9 public static $x = 'in X (static)';
10 public $y = 'in X (instance)';
12 public static function getS() {
13 return static function() {
14 echo "self::\$x = "; var_dump(self
::$x);
15 echo "static::\$x = "; var_dump(static::$x);
19 public function get() {
21 echo "\$this->y = "; var_dump($this->y
);
22 echo "self::\$x = "; var_dump(self
::$x);
23 echo "static::\$x = "; var_dump(static::$x);
28 echo "\$d = \$staticNS->bindto(NULL, 'Y');\n";
29 $staticNS = static function() {
30 echo "self::\$x = "; var_dump(self
::$x);
31 echo "static::\$x = "; var_dump(static::$x);
33 $d = $staticNS->bindto(NULL, 'Y');
34 $res = (new ReflectionFunction($d))->getClosureScopeClass();
36 var_dump($res->getName());
41 echo "=====================================================\n";
42 echo "\$d = \$staticS->bindto(NULL, 'Y');\n";
44 $d = $staticS->bindto(NULL, 'Y');
45 $res = (new ReflectionFunction($d))->getClosureScopeClass();
47 var_dump($res->getName());
52 echo "=====================================================\n";
53 echo "\$R = \$Q->bindto(new Y, 'static');\n";
56 $R = $Q->bindto(new Y
, 'static');
57 $res = (new ReflectionFunction($R))->getClosureScopeClass();
59 var_dump($res->getName());
63 echo "=====================================================\n";
64 echo "\$R = \$Q->bindto(new Y, 'X');\n";
67 $R = $Q->bindto(new Y
, 'X');
68 $res = (new ReflectionFunction($R))->getClosureScopeClass();
70 var_dump($res->getName());
75 echo "=====================================================\n";
76 echo "\$R = \$Q->bindto(new Y, 'Y');\n";
79 $R = $Q->bindto(new Y
, 'Y');
80 $res = (new ReflectionFunction($R))->getClosureScopeClass();
82 var_dump($res->getName());