3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class TestingInjectingToProtected { protected $value; public function getValue(); } $object = new TestingInjectingToProtected(); $reflection = new ReflectionObject($object); $property = $reflection->getProperty('value'); $property->setAccessible(true); $object->value = 'foo'; $property->setAccessible(false); echo $object->getValue(); $injector = Closure::bindTo(function ($property, $value) { $this->$property = $value; }, $object); $injector('value', 'bar'); echo $object->getValue();
Output for 5.3.0 - 5.4.15
Fatal error: Non-abstract method TestingInjectingToProtected::getValue() must contain body in /in/Xj5Ln on line 7
Process exited with code 255.