3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface FabricAwareInterface { public function setFabric($fabric); public function getFabric(); } trait FabricAware { private $_fabric; public function setFabric($f) { $this->_fabric = $f; } protected function getFabric() { return $this->_fabric; } } class ClassA implements FabricAwareInterface { use FabricAware; public function init() { echo 'OK'; } } $a = new ClassA(); $a->init();
based on 07rXY
Output for 7.0.6 - 7.2.0
Fatal error: Access level to ClassA::getFabric() must be public (as in class FabricAwareInterface) in /in/Op20H on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Fatal error: Access level to FabricAware::getFabric() must be public (as in class FabricAwareInterface) in /in/Op20H on line 19
Process exited with code 255.
Output for 5.5.25 - 5.5.35, 5.6.9 - 5.6.28
Fatal error: Access level to FabricAware::getFabric() must be public (as in class FabricAwareInterface) in /in/Op20H on line 25
Process exited with code 255.
Output for 5.4.11 - 5.5.24, 5.6.8
OK
Output for 5.4.10
Fatal error: Access level to ClassA::getFabric() must be public (as in class FabricAwareInterface) in /in/Op20H on line 25
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/Op20H on line 9
Process exited with code 255.