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);}; $a = new A; $method = $method->bindTo($a, 'A'); $method();

preferences:
33.15 ms | 402 KiB | 5 Q