3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a = 'public'; protected $_b = 'protected'; private $_c = 'private'; } $method = function (){ global $x =& $this; $x = new stdClass; var_dump($this, $this->a);}; $a = new A; $method = $method->bindTo($a); $method(); var_dump($this);
Output for 5.3.0 - 5.3.13, 5.4.0 - 5.4.3
Parse error: syntax error, unexpected '=', expecting ',' or ';' in /in/9dntj on line 9
Process exited with code 255.

preferences:
171.08 ms | 1399 KiB | 25 Q