3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a = 'public'; protected $_b = 'protected'; private $_c = 'private'; } $method = function (){ $x =& $this; $x = new stdClass; var_dump($this, $this->a, $x);}; $a = new A; $method = $method->bindTo($a); $method();

preferences:
36.17 ms | 402 KiB | 5 Q