3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { protected function _a() { return 'waa?'; } } $c = function() { return $this->_a(); }; $a = new A; $c = $c->bindTo($a); $c();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to protected method A::_a() from context 'Closure' in /in/L3haa:11 Stack trace: #0 /in/L3haa(15): Closure->{closure}() #1 {main} thrown in /in/L3haa on line 11
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Fatal error: Call to protected method A::_a() from context 'Closure' in /in/L3haa on line 11
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Fatal error: Call to undefined method Closure::bindTo() in /in/L3haa on line 14
Process exited with code 255.