3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { private $a = 1; } function deprivatise($obj, $callback) { $thief = function($obj) { call_user_func($callback, $obj); } $objTheif = Closure::bind($thief, null, $obj); return $objTheif($obj); } $bar = new Foo; echo deprivatise($bar, function($ths) { return $ths->a; }) . PHP_EOL;
Output for 5.4.18 - 5.4.19
Parse error: syntax error, unexpected '$objTheif' (T_VARIABLE) in /in/9TpKn on line 12
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '$objTheif' (T_VARIABLE) in /in/75c3a on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/75c3a on line 12
Process exited with code 255.