3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait Error { private $_errors; private function _init(){ $this->_errors = (object) [ 'small' => 'Small mistake' ]; } public function getError(){ var_dump($this->_errors); } } class Test { use Error; public function __construct(){ $this->_errors = $this->_init(); } } $obj = new Test(); $obj->getError();
based on ntsha
Output for 7.0.0 - 7.3.0rc3
Fatal error: Cannot declare trait Error, because the name is already in use in /in/F1Cta on line 3
Process exited with code 255.
Output for 5.6.0 - 5.6.30, hhvm-3.12.14 - 3.17.3
NULL