Created
January 19, 2023 17:31
-
-
Save iluuu1994/c7950245c13c21f559c81776100b09e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
public function __get($name, $scope) { | |
var_dump($scope); | |
return ''; | |
} | |
} | |
$foo = new Foo(); | |
$foo->bar; // null, called from global scope | |
function test() { | |
$foo = new Foo(); | |
$foo->bar; // null, called from non-class scope | |
} | |
class Test { | |
public static function staticTest() { | |
$foo = new Foo(); | |
$foo->bar; // Test | |
} | |
public function test() { | |
$foo = new Foo(); | |
$foo->bar; // Test | |
} | |
} | |
(function () { | |
$foo = new Foo(); | |
$foo->bar; // Test | |
})->bindTo(null, Test::class)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment