3v4l.org

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

preferences:
174.97 ms | 1395 KiB | 25 Q